aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2017-12-21 19:16:36 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2017-12-21 19:16:36 +1000
commitcf044120cad3ff1aa2fd40b4ae8989f7e898546e (patch)
treeef065acc1fe184adc512676f44f34a7f3b8626a2 /src/Java
parentecc60485f31011bf9cc6a02edb985fb683793bb7 (diff)
downloadGT5-Unofficial-cf044120cad3ff1aa2fd40b4ae8989f7e898546e.tar.gz
GT5-Unofficial-cf044120cad3ff1aa2fd40b4ae8989f7e898546e.tar.bz2
GT5-Unofficial-cf044120cad3ff1aa2fd40b4ae8989f7e898546e.zip
+ Added a better Ai and combat mechanics to the Staballoy Constructs.
+ Tried to implement new World generation for my dimension. % Small tweak to gitignore.
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gtPlusPlus/GTplusplus_Secondary.java77
-rw-r--r--src/Java/gtPlusPlus/api/objects/Logger.java8
-rw-r--r--src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java6
-rw-r--r--src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java163
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java2
-rw-r--r--src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java803
-rw-r--r--src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java9
-rw-r--r--src/Java/gtPlusPlus/core/world/darkworld/block/DarkWorldContentLoader.java2
-rw-r--r--src/Java/gtPlusPlus/core/world/darkworld/gen/WorldGenMinable_Custom.java142
-rw-r--r--src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Base.java412
-rw-r--r--src/Java/gtPlusPlus/core/world/darkworld/gen/gt/WorldGen_GT_Ore_Layer.java272
11 files changed, 1362 insertions, 534 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus_Secondary.java b/src/Java/gtPlusPlus/GTplusplus_Secondary.java
index 670f6d0fc8..329d3fdb1d 100644
--- a/src/Java/gtPlusPlus/GTplusplus_Secondary.java
+++ b/src/Java/gtPlusPlus/GTplusplus_Secondary.java
@@ -1,10 +1,9 @@
package gtPlusPlus;
import java.io.File;
-import java.util.Random;
import cofh.mod.ChildMod;
-import cpw.mods.fml.common.*;
+import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.CustomProperty;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.*;
@@ -15,11 +14,9 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld;
import gtPlusPlus.core.world.darkworld.biome.Biome_DarkWorld;
import gtPlusPlus.core.world.darkworld.block.DarkWorldContentLoader;
+import gtPlusPlus.core.world.darkworld.gen.gt.WorldGen_GT_Base;
import gtPlusPlus.xmod.gregtech.HANDLER_GT;
import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config;
-import net.minecraft.item.ItemStack;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.config.Configuration;
@@ -29,28 +26,16 @@ name = "GT++ Dark World",
version = CORE.VERSION,
dependencies = "after:Miscutils;after:Gregtech",
customProperties = @CustomProperty(k = "cofhversion", v = "true")))
-public class GTplusplus_Secondary implements IFuelHandler, IWorldGenerator{
+public class GTplusplus_Secondary {
public static final String MODID2 = "GT++ Dark World";
public static final String VERSION2 = "0.1";
// Dark World Handler
- Biome_DarkWorld DarkWorld_Biome;
- Dimension_DarkWorld DarkWorld_Dimension;
+ protected static volatile Biome_DarkWorld DarkWorld_Biome;
+ protected static volatile Dimension_DarkWorld DarkWorld_Dimension;
public static int globalDarkWorldPortalSpawnTimer = 0;
- @EventHandler
- public void load(final FMLInitializationEvent e) {
- Logger.INFO("Begin resource allocation for " + MODID2 + " V" + VERSION2);
-
- //Load Dark World and Biome
- GameRegistry.registerFuelHandler(this);
- GameRegistry.registerWorldGenerator(this, 1);
- DarkWorld_Biome.load();
- DarkWorld_Dimension.load();
-
- }
-
// Pre-Init
@Mod.EventHandler
public void preInit(final FMLPreInitializationEvent event) {
@@ -59,50 +44,74 @@ public class GTplusplus_Secondary implements IFuelHandler, IWorldGenerator{
//Setup
setVars();
- DarkWorld_Biome = new Biome_DarkWorld();
+ setDarkBiome(new Biome_DarkWorld());
DarkWorld_Dimension = new Dimension_DarkWorld();
// Load Dark World
- DarkWorld_Biome.instance = GTplusplus.instance;
+ getDarkBiome().instance = GTplusplus.instance;
DarkWorld_Dimension.instance = GTplusplus.instance;
- DarkWorld_Biome.preInit(event);
+ getDarkBiome().preInit(event);
DarkWorld_Dimension.preInit(event);
//Load/Set Custom Ore Gen
HANDLER_GT.sCustomWorldgenFile = new GTPP_Config(new Configuration(new File(new File(event.getModConfigurationDirectory(), "GTplusplus"), "WorldGeneration.cfg")));
}
+
+ @EventHandler
+ public void load(final FMLInitializationEvent e) {
+ Logger.INFO("Begin resource allocation for " + MODID2 + " V" + VERSION2);
+
+ //Load Dark World and Biome
+ //GameRegistry.registerFuelHandler(this);
+ GameRegistry.registerWorldGenerator(new WorldGen_GT_Base(), 50);
+ getDarkBiome().load();
+ DarkWorld_Dimension.load();
+
+ }
void setVars(){
if (DimensionManager.isDimensionRegistered(Dimension_DarkWorld.DIMID)){
Dimension_DarkWorld.DIMID = DimensionManager.getNextFreeDimId();
}
+
+ /*
+ * Set World Generation Values
+ */
+
+ WorldGen_GT_Base.oreveinPercentage = 75;
+ WorldGen_GT_Base.oreveinAttempts = 64;
+ WorldGen_GT_Base.oreveinMaxPlacementAttempts = 8;
+ if (CORE.DEBUG || CORE.DEVENV){
+ WorldGen_GT_Base.debugWorldGen = true;
+ }
+
DarkWorldContentLoader.run();
}
@EventHandler
public void serverLoad(FMLServerStartingEvent event) {
- DarkWorld_Biome.serverLoad(event);
+ getDarkBiome().serverLoad(event);
DarkWorld_Dimension.serverLoad(event);
}
- @Override
+ /*@Override
public int getBurnTime(ItemStack fuel) {
if (DarkWorld_Biome.addFuel(fuel) != 0)
return DarkWorld_Biome.addFuel(fuel);
if (DarkWorld_Dimension.addFuel(fuel) != 0)
return DarkWorld_Dimension.addFuel(fuel);
return 0;
- }
+ }*/
- @Override
+ /*@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
chunkX = chunkX * 16;
chunkZ = chunkZ * 16;
- /*if (world.provider.dimensionId == Dimension_DarkWorld.DIMID) {
+ if (world.provider.dimensionId == Dimension_DarkWorld.DIMID) {
DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ);
- }*/
+ }
//What does this even do?
if (world.provider.dimensionId == -1) {
@@ -112,11 +121,19 @@ public class GTplusplus_Secondary implements IFuelHandler, IWorldGenerator{
DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ);
}
- }
+ }*/
@EventHandler
public static void postInit(final FMLPostInitializationEvent e) {
Logger.INFO("Finished loading Dark World plugin for GT++.");
}
+ public static synchronized Biome_DarkWorld getDarkBiome() {
+ return DarkWorld_Biome;
+ }
+
+ public static synchronized void setDarkBiome(Biome_DarkWorld darkWorld_Biome) {
+ DarkWorld_Biome = darkWorld_Biome;
+ }
+
}
diff --git a/src/Java/gtPlusPlus/api/objects/Logger.java b/src/Java/gtPlusPlus/api/objects/Logger.java
index 44657d337a..7ed5dbde3a 100644
--- a/src/Java/gtPlusPlus/api/objects/Logger.java
+++ b/src/Java/gtPlusPlus/api/objects/Logger.java
@@ -124,7 +124,15 @@ public class Logger {
if (CORE.DEVENV || CORE.DEBUG)
modLogger.info("[Reflection] "+s);
}
+
+ /**
+ * Special Logger for Darkworld related content
+ */
+ public static void WORLD(final String s) {
+ if (CORE.DEVENV || CORE.DEBUG)
+ modLogger.info("[WorldGen] "+s);
+ }
diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java b/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java
index 13ecf99bc1..4e2a4c4439 100644
--- a/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java
+++ b/src/Java/gtPlusPlus/core/entity/monster/EntitySickBlaze.java
@@ -5,7 +5,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import gtPlusPlus.core.entity.projectile.EntityToxinballSmall;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
-import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -216,4 +215,9 @@ public class EntitySickBlaze extends EntityMob {
protected boolean isValidLightLevel() {
return true;
}
+
+ @Override
+ public int getMaxSpawnedInChunk() {
+ return 8;
+ }
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java
index 5a3e0348fe..cd7878273f 100644
--- a/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java
+++ b/src/Java/gtPlusPlus/core/entity/monster/EntityStaballoyConstruct.java
@@ -4,9 +4,11 @@ import java.lang.reflect.Field;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.util.item.ItemUtils;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.core.world.explosions.ExplosionHandler;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.*;
@@ -22,16 +24,19 @@ import net.minecraft.village.Village;
import net.minecraft.world.World;
public class EntityStaballoyConstruct extends EntityIronGolem {
-
+
/*
* Determines whether or not the entity is in a fluid at all.
*/
private volatile boolean inFluid = false;
private volatile boolean mReflectFirstUpdate = true;
+ private volatile boolean isReadyToExplode = false;
+ private volatile int fuse = 60;
private volatile int attackTimer;
public EntityStaballoyConstruct(World world) {
super(world);
+ this.experienceValue = 250;
this.setSize(1.4F, 2.9F);
this.getNavigator().setAvoidsWater(true);
this.getNavigator().setBreakDoors(true);
@@ -48,6 +53,28 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLiving.class, 0, false, true, IMob.mobSelector));
}
+ /**
+ * (abstract) Protected helper method to write subclass entity data to NBT.
+ */
+ @Override
+ public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
+ super.writeEntityToNBT(p_70014_1_);
+ p_70014_1_.setBoolean("inFluid", this.inFluid);
+ p_70014_1_.setBoolean("isReadyToExplode", this.isReadyToExplode);
+ p_70014_1_.setInteger("fuse", this.fuse);
+ }
+
+ /**
+ * (abstract) Protected helper method to read subclass entity data from NBT.
+ */
+ @Override
+ public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
+ super.readEntityFromNBT(p_70037_1_);
+ this.inFluid = p_70037_1_.getBoolean("inFluid");
+ this.isReadyToExplode = p_70037_1_.getBoolean("isReadyToExplode");
+ this.fuse = p_70037_1_.getInteger("fuse");
+ }
+
@Override
protected void entityInit() {
super.entityInit();
@@ -136,24 +163,6 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
return clazz.equals(this.getClass()) ? false : true;
}
- /**
- * (abstract) Protected helper method to write subclass entity data to NBT.
- */
- @Override
- public void writeEntityToNBT(NBTTagCompound p_70014_1_) {
- super.writeEntityToNBT(p_70014_1_);
- p_70014_1_.setBoolean("PlayerCreated", this.isPlayerCreated());
- }
-
- /**
- * (abstract) Protected helper method to read subclass entity data from NBT.
- */
- @Override
- public void readEntityFromNBT(NBTTagCompound p_70037_1_) {
- super.readEntityFromNBT(p_70037_1_);
- this.setPlayerCreated(p_70037_1_.getBoolean("PlayerCreated"));
- }
-
@Override
public boolean attackEntityAsMob(Entity p_70652_1_) {
this.attackTimer = 10;
@@ -285,8 +294,15 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
this.isImmuneToFire = true;
}
+ if (this.getHealth() <= (this.getMaxHealth()*MathUtils.randDouble(0.02, 0.15))){
+ float r = MathUtils.randFloat(0, 1);
+ if (r <= 0.1){
+ this.isReadyToExplode = true;
+ }
+ }
+
//Handle Exploding
- if (isReadyToExplode){
+ if (isReadyToExplode){
if (this.fuse-- <= 0){
this.setDead();
@@ -295,20 +311,63 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
this.explode();
}
}
- else
- {
- this.worldObj.spawnParticle("smoke", this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);
+ else {
+
+ int maxFuse = 60;
+ int fuseUsed = maxFuse-this.fuse;
+ float var2 = (float) (fuseUsed * 0.1);
+
+ this.setSize(1.4F+(var2/2), 2.9F+(var2/2));
+
+ float r = MathUtils.randFloat(0, 1);
+ int r2 = MathUtils.randInt(5, 15);
+ for (int o=0;o<r2;o++){
+ if (r <= 0.3){
+ this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.6){
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+
+ }
+ if (r <= 0.3){
+ this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.7){
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+
+ }
+ if (r <= 0.2){
+ this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.5){
+ this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.7){
+ this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-2, 2), this.posY+MathUtils.randDouble(-2, 2), this.posZ+MathUtils.randDouble(-2, 2), 0.0D, 0.0D, 0.0D);
+
+ }
+ }
+
+
}
}
//Get a private field from a super class if it exists.
- if (ReflectionUtils.getField(this, "firstUpdate") != null && mReflectFirstUpdate == true){
- Field x = ReflectionUtils.getField(this, "firstUpdate");
- try {
- this.mReflectFirstUpdate = (boolean) x.get(this);
+ try {
+ if (ReflectionUtils.getField(Class.forName("net.minecraft.entity.Entity"), "firstUpdate") != null && mReflectFirstUpdate == true){
+ Field x = ReflectionUtils.getField(Class.forName("net.minecraft.entity.Entity"), "firstUpdate");
+ try {
+ this.mReflectFirstUpdate = (boolean) x.get(this);
+ Logger.REFLECTION("Successfully got 'firstUpdate' variable state via reflection.");
+ }
+ catch (IllegalArgumentException | IllegalAccessException e) {}
}
- catch (IllegalArgumentException | IllegalAccessException e) {}
}
+ catch (NoSuchFieldException | ClassNotFoundException e) {}
super.onEntityUpdate();
}
@@ -419,18 +478,54 @@ public class EntityStaballoyConstruct extends EntityIronGolem {
super.onChunkLoad();
}
- private int fuse = 60;
- private boolean isReadyToExplode = false;
@Override
public void onStruckByLightning(EntityLightningBolt p_70077_1_) {
this.isReadyToExplode = true;
this.fuse = 20;
}
-
+
private void explode(){
- float f = 12.0F;
- this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);
- }
+ /* float f = 12.0F;
+ this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);*/
+
+ final float f = 16F;
+ ExplosionHandler explode = new ExplosionHandler();
+ explode.createExplosion(this.worldObj, this, this.posX, this.posY, this.posZ, f, true, true);
+
+ float r = MathUtils.randFloat(0, 1);
+ int r2 = MathUtils.randInt(20, 40);
+ for (int o=0;o<r2;o++){
+ if (r <= 0.3){
+ this.worldObj.spawnParticle("smoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(0, 3), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.6){
+ this.worldObj.spawnParticle("largesmoke", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+
+ }
+ if (r <= 0.3){
+ this.worldObj.spawnParticle("cloud", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.7){
+ this.worldObj.spawnParticle("flame", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+
+ }
+ if (r <= 0.2){
+ this.worldObj.spawnParticle("explode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.5){
+ this.worldObj.spawnParticle("largeexplode", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+
+ }
+ else if (r <= 0.7){
+ this.worldObj.spawnParticle("hugeexplosion", this.posX+MathUtils.randDouble(-4, 4), this.posY+MathUtils.randDouble(-4, 4), this.posZ+MathUtils.randDouble(-4, 4), 0.0D, 0.0D, 0.0D);
+
+ }
+ }
+
+ }
@Override
public boolean canAttackWithItem() {
diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
index bc92328595..047f941aef 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
@@ -14,7 +14,7 @@ import net.minecraft.client.Minecraft;
public class ReflectionUtils {
- public static Field getField(final Class<?> clazz, final String fieldName) throws NoSuchFieldException {
+ public static Field getField(final Class clazz, final String fieldName) throws NoSuchFieldException {
try {
return clazz.getDeclaredField(fieldName);
} catch (final NoSuchFieldException e) {
diff --git a/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java b/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java
index 0dc84b8aa3..e6425ca4cb 100644
--- a/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java
+++ b/src/Java/gtPlusPlus/core/world/darkworld/biome/BiomeGenerator_Custom.java
@@ -5,11 +5,9 @@ import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.Ev
import java.util.Random;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.world.darkworld.gen.WorldGenDeadLilly;
import gtPlusPlus.core.world.darkworld.gen.WorldGenMinable_Custom;
-import net.minecraft.block.BlockFlower;
-import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeDecorator;
@@ -19,406 +17,429 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.terraingen.*;
public class BiomeGenerator_Custom extends BiomeDecorator {
- /** The world the BiomeDecorator is currently decorating */
- public World currentWorld;
- /** The Biome Decorator's random number generator. */
- public Random randomGenerator;
- /** The X-coordinate of the chunk currently being decorated */
- public int chunk_X;
- /** The Z-coordinate of the chunk currently being decorated */
- public int chunk_Z;
- /** The clay generator. */
- public WorldGenerator clayGen = new WorldGenClay(4);
- /** The sand generator. */
- public WorldGenerator sandGen;
- /** The gravel generator. */
- public WorldGenerator gravelAsSandGen;
- /** The dirt generator. */
- public WorldGenerator dirtGen;
- public WorldGenerator gravelGen;
- public WorldGenerator coalGen;
- public WorldGenerator ironGen;
- /** Field that holds gold WorldGenMinable */
- public WorldGenerator goldGen;
- /** Field that holds redstone WorldGenMinable */
- public WorldGenerator redstoneGen;
- /** Field that holds diamond WorldGenMinable */
- public WorldGenerator diamondGen;
- /** Field that holds Lapis WorldGenMinable */
- public WorldGenerator lapisGen;
- public WorldGenFlowers yellowFlowerGen;
- /** Field that holds mushroomBrown WorldGenFlowers */
- public WorldGenerator mushroomBrownGen;
- /** Field that holds mushroomRed WorldGenFlowers */
- public WorldGenerator mushroomRedGen;
- /** Field that holds big mushroom generator */
- public WorldGenerator bigMushroomGen;
- /** Field that holds WorldGenReed */
- public WorldGenerator reedGen;
- /** Field that holds WorldGenCactus */
- public WorldGenerator cactusGen;
- /** The water lily generation! */
- public WorldGenerator waterlilyGen;
- /** Amount of waterlilys per chunk. */
- public int waterlilyPerChunk;
- /** The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts. */
- public int treesPerChunk;
- /**
- * The number of yellow flower patches to generate per chunk. The game generates much less than this number, since
- * it attempts to generate them at a random altitude.
- */
- public int flowersPerChunk;
- /** The amount of tall grass to generate per chunk. */
- public int grassPerChunk;
- /** The number of dead bushes to generate per chunk. Used in deserts and swamps. */
- public int deadBushPerChunk;
- /**
- * The number of extra mushroom patches per chunk. It generates 1/4 this number in brown mushroom patches, and 1/8
- * this number in red mushroom patches. These mushrooms go beyond the default base number of mushrooms.
- */
- public int mushroomsPerChunk;
- /** The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable. */
- public int reedsPerChunk;
- /** The number of cactus plants to generate per chunk. Cacti only work on sand. */
- public int cactiPerChunk;
- /** The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. */
- public int sandPerChunk;
- /**
- * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. There
- * appear to be two separate fields for this.
- */
- public int sandPerChunk2;
- /** The number of clay patches to generate per chunk. Only generates when part of it is underwater. */
- public int clayPerChunk;
- /** Amount of big mushrooms per chunk */
- public int bigMushroomsPerChunk;
- /** True if decorator should generate surface lava & water */
- public boolean generateLakes;
-
- public WorldGenerator fluoriteGen;
-
- public BiomeGenerator_Custom(){
- //Basic Blocks
- this.sandGen = new WorldGenMinable_Custom(Blocks.sand, 12);
- this.gravelAsSandGen = new WorldGenMinable_Custom(Blocks.gravel, 8);
- this.dirtGen = new WorldGenMinable_Custom(Blocks.dirt, 32);
- this.gravelGen = new WorldGenMinable_Custom(Blocks.gravel, 12);
-
-
- //Oregen
- this.coalGen = new WorldGenMinable_Custom(Blocks.coal_ore, 16);
- this.ironGen = new WorldGenMinable_Custom(Blocks.iron_ore, 12);
- this.goldGen = new WorldGenMinable_Custom(Blocks.gold_ore, 12);
- this.redstoneGen = new WorldGenMinable_Custom(Blocks.redstone_ore, 10);
- this.diamondGen = new WorldGenMinable_Custom(Blocks.diamond_ore, 12);
- this.lapisGen = new WorldGenMinable_Custom(Blocks.lapis_ore, 8);
- this.fluoriteGen = new WorldGenMinable_Custom(ModBlocks.blockOreFluorite, 20);
-
- //Nature
- this.yellowFlowerGen = new WorldGenFlowers(Blocks.yellow_flower);
- this.mushroomBrownGen = new WorldGenFlowers(Blocks.brown_mushroom);
- this.mushroomRedGen = new WorldGenFlowers(Blocks.red_mushroom);
- this.bigMushroomGen = new WorldGenBigMushroom();
- this.reedGen = new WorldGenReed();
- this.cactusGen = new WorldGenCactus();
- this.waterlilyGen = new WorldGenDeadLilly();
-
- this.flowersPerChunk = 1;
- this.grassPerChunk = 5;
- this.sandPerChunk = 3;
- this.sandPerChunk2 = 5;
- this.clayPerChunk = 7;
-
- this.generateLakes = true;
- }
-
- @Override
- public void decorateChunk(World p_150512_1_, Random p_150512_2_, BiomeGenBase p_150512_3_, int p_150512_4_, int p_150512_5_)
- {
- if (this.currentWorld != null)
- {
- throw new RuntimeException("Already decorating!!");
- }
- else
- {
- this.currentWorld = p_150512_1_;
- this.randomGenerator = p_150512_2_;
- this.chunk_X = p_150512_4_;
- this.chunk_Z = p_150512_5_;
- this.genDecorations(p_150512_3_);
- this.currentWorld = null;
- this.randomGenerator = null;
- }
- }
-
- @Override
- protected void genDecorations(BiomeGenBase p_150513_1_)
- {
- MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
- this.generateOres();
- int i;
- int j;
- int k;
-
- boolean doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND);
- for (i = 0; doGen && i < this.sandPerChunk2; ++i)
- {
- j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
- k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
- this.sandGen.generate(this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k);
- }
-
- doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CLAY);
- for (i = 0; doGen && i < this.clayPerChunk; ++i)
- {
- j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
- k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
- this.clayGen.generate(this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k);
- }
-
- doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND_PASS2);
- for (i = 0; doGen && i < this.sandPerChunk; ++i)
- {
- j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
- k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
- this.gravelAsSandGen.generate(this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k);
- }
-
- i = this.treesPerChunk;
-
- if (this.randomGenerator.nextInt(10) == 0)
- {
- ++i;
- }
-
- int l;
- int i1;
+ /** The world the BiomeDecorator is currently decorating */
+ public World currentWorld;
+ /** The Biome Decorator's random number generator. */
+ public Random randomGenerator;
+ /** The X-coordinate of the chunk currently being decorated */
+ public int chunk_X;
+ /** The Z-coordinate of the chunk currently being decorated */
+ public int chunk_Z;
+ /** The clay generator. */
+ public WorldGenerator clayGen = new WorldGenClay(4);
+ /** The sand generator. */
+ public WorldGenerator sandGen;
+ /** The gravel generator. */
+ public WorldGenerator gravelAsSandGen;
+ /** The dirt generator. */
+ public WorldGenerator dirtGen;
+ public WorldGenerator gravelGen;
+ public WorldGenerator coalGen;
+ public WorldGenerator ironGen;
+ /** Field that holds gold WorldGenMinable */
+ public WorldGenerator goldGen;
+ /** Field that holds redstone WorldGenMinable */
+ public WorldGenerator redstoneGen;
+ /** Field that holds diamond WorldGenMinable */
+ public WorldGenerator diamondGen;
+ /** Field that holds Lapis WorldGenMinable */
+ public WorldGenerator lapisGen;
+ public WorldGenFlowers yellowFlowerGen;
+ /** Field that holds mushroomBrown WorldGenFlowers */
+ public WorldGenerator mushroomBrownGen;
+ /** Field that holds mushroomRed WorldGenFlowers */
+ public WorldGenerator mushroomRedGen;
+ /** Field that holds big mushroom generator */
+ public WorldGenerator bigMushroomGen;
+ /** Field that holds WorldGenReed */
+ public WorldGenerator reedGen;
+ /** Field that holds WorldGenCactus */
+ public WorldGenerator cactusGen;
+ /** The water lily generation! */
+ public WorldGenerator waterlilyGen;
+ /** Amount of waterlilys per chunk. */
+ public int waterlilyPerChunk;
+ /** The number of trees to attempt to generate per chunk. Up to 10 in forests, none in deserts. */
+ public int treesPerChunk;
+ /**
+ * The number of yellow flower patches to generate per chunk. The game generates much less than this number, since
+ * it attempts to generate them at a random altitude.
+ */
+ public int flowersPerChunk;
+ /** The amount of tall grass to generate per chunk. */
+ public int grassPerChunk;
+ /** The number of dead bushes to generate per chunk. Used in deserts and swamps. */
+ public int deadBushPerChunk;
+ /**
+ * The number of extra mushroom patches per chunk. It generates 1/4 this number in brown mushroom patches, and 1/8
+ * this number in red mushroom patches. These mushrooms go beyond the default base number of mushrooms.
+ */
+ public int mushroomsPerChunk;
+ /** The number of reeds to generate per chunk. Reeds won't generate if the randomly selected placement is unsuitable. */
+ public int reedsPerChunk;
+ /** The number of cactus plants to generate per chunk. Cacti only work on sand. */
+ public int cactiPerChunk;
+ /** The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. */
+ public int sandPerChunk;
+ /**
+ * The number of sand patches to generate per chunk. Sand patches only generate when part of it is underwater. There
+ * appear to be two separate fields for this.
+ */
+ public int sandPerChunk2;
+ /** The number of clay patches to generate per chunk. Only generates when part of it is underwater. */
+ public int clayPerChunk;
+ /** Amount of big mushrooms per chunk */
+ public int bigMushroomsPerChunk;
+ /** True if decorator should generate surface lava & water */
+ public boolean generateLakes;
+
+ public WorldGenerator fluoriteGen;
+
+ public BiomeGenerator_Custom(){
+ //Basic Blocks
+ this.sandGen = new WorldGenMinable(Blocks.sand, 12);
+ this.gravelAsSandGen = new WorldGenMinable(Blocks.gravel, 8);
+ this.dirtGen = new WorldGenMinable(Blocks.dirt, 32);
+ this.gravelGen = new WorldGenMinable(Blocks.gravel, 12);
+
+
+ //Oregen
+ this.coalGen = new WorldGenMinable_Custom(Blocks.coal_ore, 32);
+ this.ironGen = new WorldGenMinable_Custom(Blocks.iron_ore, 16);
+ this.goldGen = new WorldGenMinable_Custom(Blocks.gold_ore, 16);
+ this.redstoneGen = new WorldGenMinable_Custom(Blocks.redstone_ore, 16);
+ this.diamondGen = new WorldGenMinable_Custom(Blocks.diamond_ore, 24);
+ this.lapisGen = new WorldGenMinable_Custom(Blocks.lapis_ore, 24);
+ this.fluoriteGen = new WorldGenMinable_Custom(ModBlocks.blockOreFluorite, 24);
+
+/* //Nature
+ this.yellowFlowerGen = new WorldGenFlowers(Blocks.yellow_flower);
+ this.mushroomBrownGen = new WorldGenFlowers(Blocks.brown_mushroom);
+ this.mushroomRedGen = new WorldGenFlowers(Blocks.red_mushroom);
+ this.bigMushroomGen = new WorldGenBigMushroom();
+ this.reedGen = new WorldGenReed();
+ this.cactusGen = new WorldGenCactus();
+ this.waterlilyGen = new WorldGenDeadLilly();
+*/
+
+ this.grassPerChunk = 1;
+ this.sandPerChunk = 6;
+ this.sandPerChunk2 = 8;
+ this.clayPerChunk = 4;
+ this.treesPerChunk = 12;
+
+ this.generateLakes = true;
+ }
- doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, TREE);
- for (j = 0; doGen && j < i; ++j)
- {
- k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
- l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
- i1 = this.currentWorld.getHeightValue(k, l);
- WorldGenAbstractTree worldgenabstracttree = p_150513_1_.func_150567_a(this.randomGenerator);
- worldgenabstracttree.setScale(1.0D, 1.0D, 1.0D);
-
- if (worldgenabstracttree.generate(this.currentWorld, this.randomGenerator, k, i1, l))
- {
- worldgenabstracttree.func_150524_b(this.currentWorld, this.randomGenerator, k, i1, l);
- }
- }
-
- doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, BIG_SHROOM);
- for (j = 0; doGen && j < this.bigMushroomsPerChunk; ++j)
- {
- k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
- l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
- this.bigMushroomGen.generate(this.currentWorld, this.randomGenerator, k, this.currentWorld.getHeightValue(k, l), l);
- }
+ @Override
+ public void decorateChunk(World p_150512_1_, Random p_150512_2_, BiomeGenBase p_150512_3_, int p_150512_4_, int p_150512_5_)
+ {
+ Logger.WORLD("Trying to decorate world, using BBS randomization.");
+ if (this.currentWorld != null)
+ {
+ //throw new RuntimeException("Already decorating!!");
+ }
+ else
+ {
+ this.currentWorld = p_150512_1_;
+ //this.randomGenerator = CSPRNG.generate();
+ this.randomGenerator = p_150512_2_;
+ this.chunk_X = p_150512_4_;
+ this.chunk_Z = p_150512_5_;
+ this.genDecorations(p_150512_3_);
+ this.currentWorld = null;
+ this.randomGenerator = null;
+ }
+ }
- doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, FLOWERS);
- for (j = 0; doGen && j < this.flowersPerChunk; ++j)
- {
- k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
- l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
- i1 = nextInt(this.currentWorld.getHeightValue(k, l) + 32);
- String s = p_150513_1_.func_150572_a(this.randomGenerator, k, i1, l);
- BlockFlower blockflower = BlockFlower.func_149857_e(s);
-
- if (blockflower.getMaterial() != Material.air)
- {
- this.yellowFlowerGen.func_150550_a(blockflower, BlockFlower.func_149856_f(s));
- this.yellowFlowerGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
- }
- }
-
- doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, GRASS);
+