aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/everglades
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/everglades')
-rw-r--r--src/main/java/gtPlusPlus/everglades/GTplusplus_Everglades.java349
-rw-r--r--src/main/java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java173
-rw-r--r--src/main/java/gtPlusPlus/everglades/biome/Biome_Everglades.java255
-rw-r--r--src/main/java/gtPlusPlus/everglades/biome/GenLayerBiomes.java42
-rw-r--r--src/main/java/gtPlusPlus/everglades/biome/GenLayerEverglades.java42
-rw-r--r--src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldGround.java29
-rw-r--r--src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPollutedDirt.java108
-rw-r--r--src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPortalFrame.java40
-rw-r--r--src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldSludgeFluid.java172
-rw-r--r--src/main/java/gtPlusPlus/everglades/block/BlockEvergladesPortal.java770
-rw-r--r--src/main/java/gtPlusPlus/everglades/block/DarkWorldContentLoader.java111
-rw-r--r--src/main/java/gtPlusPlus/everglades/dimension/Dimension_Everglades.java34
-rw-r--r--src/main/java/gtPlusPlus/everglades/gen/WorldGenDeadLilly.java12
-rw-r--r--src/main/java/gtPlusPlus/everglades/gen/WorldGenMinable_Custom.java141
-rw-r--r--src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT.java89
-rw-r--r--src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java983
-rw-r--r--src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java1073
-rw-r--r--src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java180
-rw-r--r--src/main/java/gtPlusPlus/everglades/item/ItemBlockToxicEverglades.java53
-rw-r--r--src/main/java/gtPlusPlus/everglades/item/ItemEvergladesPortalTrigger.java169
-rw-r--r--src/main/java/gtPlusPlus/everglades/object/BoxedQuad.java101
-rw-r--r--src/main/java/gtPlusPlus/everglades/world/CustomWorldType.java99
-rw-r--r--src/main/java/gtPlusPlus/everglades/world/EvergladesPortalPosition.java16
-rw-r--r--src/main/java/gtPlusPlus/everglades/world/TeleporterDimensionMod.java918
-rw-r--r--src/main/java/gtPlusPlus/everglades/world/WorldChunkManagerCustom.java482
-rw-r--r--src/main/java/gtPlusPlus/everglades/world/WorldProviderMod.java99
26 files changed, 3324 insertions, 3216 deletions
diff --git a/src/main/java/gtPlusPlus/everglades/GTplusplus_Everglades.java b/src/main/java/gtPlusPlus/everglades/GTplusplus_Everglades.java
index ef8aa080c2..bc137390b6 100644
--- a/src/main/java/gtPlusPlus/everglades/GTplusplus_Everglades.java
+++ b/src/main/java/gtPlusPlus/everglades/GTplusplus_Everglades.java
@@ -1,9 +1,5 @@
package gtPlusPlus.everglades;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
@@ -27,179 +23,186 @@ import gtPlusPlus.everglades.gen.gt.WorldGen_Ores;
import gtPlusPlus.preloader.CORE_Preloader;
import gtPlusPlus.xmod.gregtech.HANDLER_GT;
import gtPlusPlus.xmod.gregtech.api.util.GTPP_Config;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.config.Configuration;
@MCVersion(value = "1.7.10")
-@Mod(modid = Everglades.MODID, name = Everglades.NAME, version = Everglades.VERSION, dependencies = "required-after:Forge; after:dreamcraft; after:IC2; after:ihl; required-after:gregtech; required-after:miscutils;")
+@Mod(
+ modid = Everglades.MODID,
+ name = Everglades.NAME,
+ version = Everglades.VERSION,
+ dependencies =
+ "required-after:Forge; after:dreamcraft; after:IC2; after:ihl; required-after:gregtech; required-after:miscutils;")
public class GTplusplus_Everglades implements ActionListener {
- //Mod Instance
- @Mod.Instance(Everglades.MODID)
- public static GTplusplus_Everglades instance;
-
- // Dark World Handler
- protected static volatile Biome_Everglades Everglades_Biome;
- protected static volatile Dimension_Everglades Everglades_Dimension;
- public static int globalEvergladesPortalSpawnTimer = 0;
-
- // Pre-Init
- @Mod.EventHandler
- public void preInit(final FMLPreInitializationEvent event) {
- Logger.INFO("Loading " + Everglades.MODID + " V" + Everglades.VERSION);
-
- //Setup
- setVars(event);
-
- setEvergladesBiome(new Biome_Everglades());
- Everglades_Dimension = new Dimension_Everglades();
-
- // Load Dark World
- getEvergladesBiome().instance = instance;
- Everglades_Dimension.instance = instance;
- getEvergladesBiome().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 " + Everglades.MODID + " V" +Everglades.VERSION);
-
- //Load World and Biome
- GameRegistry.registerWorldGenerator(new WorldGen_GT_Base(), Short.MAX_VALUE);
- getEvergladesBiome().load();
- Everglades_Dimension.load();
-
- }
-
- public static synchronized void GenerateOreMaterials() {
- MaterialGenerator.generateOreMaterial(ORES.CROCROITE);
- MaterialGenerator.generateOreMaterial(ORES.GEIKIELITE);
- MaterialGenerator.generateOreMaterial(ORES.NICHROMITE);
- MaterialGenerator.generateOreMaterial(ORES.TITANITE);
- MaterialGenerator.generateOreMaterial(ORES.ZIMBABWEITE);
- MaterialGenerator.generateOreMaterial(ORES.ZIRCONILITE);
- MaterialGenerator.generateOreMaterial(ORES.GADOLINITE_CE);
- MaterialGenerator.generateOreMaterial(ORES.GADOLINITE_Y);
- MaterialGenerator.generateOreMaterial(ORES.LEPERSONNITE);
- MaterialGenerator.generateOreMaterial(ORES.SAMARSKITE_Y);
- MaterialGenerator.generateOreMaterial(ORES.SAMARSKITE_YB);
- MaterialGenerator.generateOreMaterial(ORES.XENOTIME);
- MaterialGenerator.generateOreMaterial(ORES.YTTRIAITE);
- MaterialGenerator.generateOreMaterial(ORES.YTTRIALITE);
- MaterialGenerator.generateOreMaterial(ORES.YTTROCERITE);
- MaterialGenerator.generateOreMaterial(ORES.ZIRCON);
- MaterialGenerator.generateOreMaterial(ORES.POLYCRASE);
- MaterialGenerator.generateOreMaterial(ORES.ZIRCOPHYLLITE);
- MaterialGenerator.generateOreMaterial(ORES.ZIRKELITE);
- MaterialGenerator.generateOreMaterial(ORES.LANTHANITE_LA);
- MaterialGenerator.generateOreMaterial(ORES.LANTHANITE_CE);
- MaterialGenerator.generateOreMaterial(ORES.LANTHANITE_ND);
- MaterialGenerator.generateOreMaterial(ORES.AGARDITE_Y);
- MaterialGenerator.generateOreMaterial(ORES.AGARDITE_CD);
- MaterialGenerator.generateOreMaterial(ORES.AGARDITE_LA);
- MaterialGenerator.generateOreMaterial(ORES.AGARDITE_ND);
- MaterialGenerator.generateOreMaterial(ORES.HIBONITE);
- MaterialGenerator.generateOreMaterial(ORES.CERITE);
- MaterialGenerator.generateOreMaterial(ORES.FLUORCAPHITE);
- MaterialGenerator.generateOreMaterial(ORES.FLORENCITE);
- MaterialGenerator.generateOreMaterial(ORES.CRYOLITE);
-
- MaterialGenerator.generateOreMaterial(ORES.LAUTARITE);
- MaterialGenerator.generateOreMaterial(ORES.LAFOSSAITE);
- MaterialGenerator.generateOreMaterial(ORES.DEMICHELEITE_BR);
- MaterialGenerator.generateOreMaterial(ORES.COMANCHEITE);
- MaterialGenerator.generateOreMaterial(ORES.PERROUDITE);
- MaterialGenerator.generateOreMaterial(ORES.HONEAITE);
- MaterialGenerator.generateOreMaterial(ORES.ALBURNITE);
- MaterialGenerator.generateOreMaterial(ORES.MIESSIITE);
- MaterialGenerator.generateOreMaterial(ORES.KASHINITE);
- MaterialGenerator.generateOreMaterial(ORES.IRARSITE);
- MaterialGenerator.generateOreMaterial(ORES.GREENOCKITE);
- MaterialGenerator.generateOreMaterial(ORES.RADIOBARITE);
- MaterialGenerator.generateOreMaterial(ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT);
-
- //Custom Ores
- if (LoadedMods.Big_Reactors) {
- MaterialGenerator.generateOreMaterial(ELEMENT.getInstance().YELLORIUM, false, false, true, new short[] {255, 242, 10});
- }
-
- }
-
- protected synchronized void setVars(FMLPreInitializationEvent event){
- //Init WorldGen config.
- HANDLER_GT.sCustomWorldgenFile = new GTPP_Config(new Configuration(new File(new File(event.getModConfigurationDirectory(), "GTplusplus"), "WorldGeneration.cfg")));
-
- if (DimensionManager.isDimensionRegistered(Dimension_Everglades.DIMID)){
- Dimension_Everglades.DIMID = DimensionManager.getNextFreeDimId();
- }
-
- /*
- * Set World Generation Values
- */
- WorldGen_Ores.generateValidOreVeins();
- WorldGen_GT_Base.oreveinPercentage = 64;
- WorldGen_GT_Base.oreveinAttempts = 16;
- WorldGen_GT_Base.oreveinMaxPlacementAttempts = 4;
- if (CORE_Preloader.DEBUG_MODE || CORE.DEVENV){
- WorldGen_GT_Base.debugWorldGen = true;
- }
- DarkWorldContentLoader.run();
- }
-
- @EventHandler
- public void serverLoad(FMLServerStartingEvent event) {
- getEvergladesBiome().serverLoad(event);
- }
-
- /*@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
- 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) {
- DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ);
- }
-
- //What does this even do?
- if (world.provider.dimensionId == -1) {
- DarkWorld_Biome.generateNether(world, random, chunkX, chunkZ);
- }
- if (world.provider.dimensionId == 0) {
- DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ);
- }
-
- }*/
-
- @EventHandler
- public static void postInit(final FMLPostInitializationEvent e) {
- Logger.INFO("Finished loading Everglades plugin for GT++.");
- }
-
- public static synchronized Biome_Everglades getEvergladesBiome() {
- return Everglades_Biome;
- }
-
- public static synchronized void setEvergladesBiome(Biome_Everglades darkWorld_Biome) {
- Everglades_Biome = darkWorld_Biome;
- }
-
- @Override
- public void actionPerformed(ActionEvent arg0) {
- // TODO Auto-generated method stub
-
- }
-
+ // Mod Instance
+ @Mod.Instance(Everglades.MODID)
+ public static GTplusplus_Everglades instance;
+
+ // Dark World Handler
+ protected static volatile Biome_Everglades Everglades_Biome;
+ protected static volatile Dimension_Everglades Everglades_Dimension;
+ public static int globalEvergladesPortalSpawnTimer = 0;
+
+ // Pre-Init
+ @Mod.EventHandler
+ public void preInit(final FMLPreInitializationEvent event) {
+ Logger.INFO("Loading " + Everglades.MODID + " V" + Everglades.VERSION);
+
+ // Setup
+ setVars(event);
+
+ setEvergladesBiome(new Biome_Everglades());
+ Everglades_Dimension = new Dimension_Everglades();
+
+ // Load Dark World
+ getEvergladesBiome().instance = instance;
+ Everglades_Dimension.instance = instance;
+ getEvergladesBiome().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 " + Everglades.MODID + " V" + Everglades.VERSION);
+
+ // Load World and Biome
+ GameRegistry.registerWorldGenerator(new WorldGen_GT_Base(), Short.MAX_VALUE);
+ getEvergladesBiome().load();
+ Everglades_Dimension.load();
+ }
+
+ public static synchronized void GenerateOreMaterials() {
+ MaterialGenerator.generateOreMaterial(ORES.CROCROITE);
+ MaterialGenerator.generateOreMaterial(ORES.GEIKIELITE);
+ MaterialGenerator.generateOreMaterial(ORES.NICHROMITE);
+ MaterialGenerator.generateOreMaterial(ORES.TITANITE);
+ MaterialGenerator.generateOreMaterial(ORES.ZIMBABWEITE);
+ MaterialGenerator.generateOreMaterial(ORES.ZIRCONILITE);
+ MaterialGenerator.generateOreMaterial(ORES.GADOLINITE_CE);
+ MaterialGenerator.generateOreMaterial(ORES.GADOLINITE_Y);
+ MaterialGenerator.generateOreMaterial(ORES.LEPERSONNITE);
+ MaterialGenerator.generateOreMaterial(ORES.SAMARSKITE_Y);
+ MaterialGenerator.generateOreMaterial(ORES.SAMARSKITE_YB);
+ MaterialGenerator.generateOreMaterial(ORES.XENOTIME);
+ MaterialGenerator.generateOreMaterial(ORES.YTTRIAITE);
+ MaterialGenerator.generateOreMaterial(ORES.YTTRIALITE);
+ MaterialGenerator.generateOreMaterial(ORES.YTTROCERITE);
+ MaterialGenerator.generateOreMaterial(ORES.ZIRCON);
+ MaterialGenerator.generateOreMaterial(ORES.POLYCRASE);
+ MaterialGenerator.generateOreMaterial(ORES.ZIRCOPHYLLITE);
+ MaterialGenerator.generateOreMaterial(ORES.ZIRKELITE);
+ MaterialGenerator.generateOreMaterial(ORES.LANTHANITE_LA);
+ MaterialGenerator.generateOreMaterial(ORES.LANTHANITE_CE);
+ MaterialGenerator.generateOreMaterial(ORES.LANTHANITE_ND);
+ MaterialGenerator.generateOreMaterial(ORES.AGARDITE_Y);
+ MaterialGenerator.generateOreMaterial(ORES.AGARDITE_CD);
+ MaterialGenerator.generateOreMaterial(ORES.AGARDITE_LA);
+ MaterialGenerator.generateOreMaterial(ORES.AGARDITE_ND);
+ MaterialGenerator.generateOreMaterial(ORES.HIBONITE);
+ MaterialGenerator.generateOreMaterial(ORES.CERITE);
+ MaterialGenerator.generateOreMaterial(ORES.FLUORCAPHITE);
+ MaterialGenerator.generateOreMaterial(ORES.FLORENCITE);
+ MaterialGenerator.generateOreMaterial(ORES.CRYOLITE);
+
+ MaterialGenerator.generateOreMaterial(ORES.LAUTARITE);
+ MaterialGenerator.generateOreMaterial(ORES.LAFOSSAITE);
+ MaterialGenerator.generateOreMaterial(ORES.DEMICHELEITE_BR);
+ MaterialGenerator.generateOreMaterial(ORES.COMANCHEITE);
+ MaterialGenerator.generateOreMaterial(ORES.PERROUDITE);
+ MaterialGenerator.generateOreMaterial(ORES.HONEAITE);
+ MaterialGenerator.generateOreMaterial(ORES.ALBURNITE);
+ MaterialGenerator.generateOreMaterial(ORES.MIESSIITE);
+ MaterialGenerator.generateOreMaterial(ORES.KASHINITE);
+ MaterialGenerator.generateOreMaterial(ORES.IRARSITE);
+ MaterialGenerator.generateOreMaterial(ORES.GREENOCKITE);
+ MaterialGenerator.generateOreMaterial(ORES.RADIOBARITE);
+ MaterialGenerator.generateOreMaterial(ORES.DEEP_EARTH_REACTOR_FUEL_DEPOSIT);
+
+ // Custom Ores
+ if (LoadedMods.Big_Reactors) {
+ MaterialGenerator.generateOreMaterial(
+ ELEMENT.getInstance().YELLORIUM, false, false, true, new short[] {255, 242, 10});
+ }
+ }
+
+ protected synchronized void setVars(FMLPreInitializationEvent event) {
+ // Init WorldGen config.
+ HANDLER_GT.sCustomWorldgenFile = new GTPP_Config(new Configuration(
+ new File(new File(event.getModConfigurationDirectory(), "GTplusplus"), "WorldGeneration.cfg")));
+
+ if (DimensionManager.isDimensionRegistered(Dimension_Everglades.DIMID)) {
+ Dimension_Everglades.DIMID = DimensionManager.getNextFreeDimId();
+ }
+
+ /*
+ * Set World Generation Values
+ */
+ WorldGen_Ores.generateValidOreVeins();
+ WorldGen_GT_Base.oreveinPercentage = 64;
+ WorldGen_GT_Base.oreveinAttempts = 16;
+ WorldGen_GT_Base.oreveinMaxPlacementAttempts = 4;
+ if (CORE_Preloader.DEBUG_MODE || CORE.DEVENV) {
+ WorldGen_GT_Base.debugWorldGen = true;
+ }
+ DarkWorldContentLoader.run();
+ }
+
+ @EventHandler
+ public void serverLoad(FMLServerStartingEvent event) {
+ getEvergladesBiome().serverLoad(event);
+ }
+
+ /*@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
+ 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) {
+ DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ);
+ }
+
+ //What does this even do?
+ if (world.provider.dimensionId == -1) {
+ DarkWorld_Biome.generateNether(world, random, chunkX, chunkZ);
+ }
+ if (world.provider.dimensionId == 0) {
+ DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ);
+ }
+
+ }*/
+
+ @EventHandler
+ public static void postInit(final FMLPostInitializationEvent e) {
+ Logger.INFO("Finished loading Everglades plugin for GT++.");
+ }
+
+ public static synchronized Biome_Everglades getEvergladesBiome() {
+ return Everglades_Biome;
+ }
+
+ public static synchronized void setEvergladesBiome(Biome_Everglades darkWorld_Biome) {
+ Everglades_Biome = darkWorld_Biome;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java b/src/main/java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java
index 0f8acd75b4..f443a6560d 100644
--- a/src/main/java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java
+++ b/src/main/java/gtPlusPlus/everglades/biome/BiomeGenerator_Custom.java
@@ -3,8 +3,9 @@ package gtPlusPlus.everglades.biome;
import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*;
import static net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType.*;
+import gtPlusPlus.everglades.gen.WorldGenDeadLilly;
+import gtPlusPlus.everglades.gen.WorldGenMinable_Custom;
import java.util.Random;
-
import net.minecraft.block.BlockFlower;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
@@ -12,27 +13,23 @@ import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeDecorator;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.gen.feature.*;
-
-import gtPlusPlus.everglades.gen.WorldGenDeadLilly;
-import gtPlusPlus.everglades.gen.WorldGenMinable_Custom;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.event.terraingen.OreGenEvent;
import net.minecraftforge.event.terraingen.TerrainGen;
public class BiomeGenerator_Custom extends BiomeDecorator {
-
+
public WorldGenerator fluoriteGen;
- public BiomeGenerator_Custom(){
- //Basic Blocks
+ 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
+
+ // 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);
@@ -40,8 +37,8 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
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
+
+ // Nature
this.yellowFlowerGen = new WorldGenFlowers(Blocks.yellow_flower);
this.mushroomBrownGen = new WorldGenFlowers(Blocks.brown_mushroom);
this.mushroomRedGen = new WorldGenFlowers(Blocks.red_mushroom);
@@ -49,25 +46,22 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
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)
- {
+ 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
- {
+ } else {
this.currentWorld = p_150512_1_;
this.randomGenerator = p_150512_2_;
this.chunk_X = p_150512_4_;
@@ -79,8 +73,7 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
@Override
- protected void genDecorations(BiomeGenBase p_150513_1_)
- {
+ protected void genDecorations(BiomeGenBase p_150513_1_) {
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
this.generateOres();
int i;
@@ -88,33 +81,32 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
int k;
boolean doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SAND);
- for (i = 0; doGen && i < this.sandPerChunk2; ++i)
- {
+ 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);
+ 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)
- {
+ 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);
+ 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)
- {
+ 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);
+ this.gravelAsSandGen.generate(
+ this.currentWorld, this.randomGenerator, j, this.currentWorld.getTopSolidOrLiquidBlock(j, k), k);
}
i = this.treesPerChunk;
- if (this.randomGenerator.nextInt(10) == 0)
- {
+ if (this.randomGenerator.nextInt(10) == 0) {
++i;
}
@@ -122,47 +114,42 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
int i1;
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, TREE);
- for (j = 0; doGen && j < i; ++j)
- {
+ 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))
- {
+ 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)
- {
+ 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);
+ this.bigMushroomGen.generate(
+ this.currentWorld, this.randomGenerator, k, this.currentWorld.getHeightValue(k, l), l);
}
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, FLOWERS);
- for (j = 0; doGen && j < this.flowersPerChunk; ++j)
- {
+ 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)
- {
+ 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);
- for (j = 0; doGen && j < this.grassPerChunk; ++j)
- {
+ for (j = 0; doGen && j < this.grassPerChunk; ++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) * 2);
@@ -171,8 +158,7 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, DEAD_BUSH);
- for (j = 0; doGen && j < this.deadBushPerChunk; ++j)
- {
+ for (j = 0; doGen && j < this.deadBushPerChunk; ++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) * 2);
@@ -180,13 +166,13 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, LILYPAD);
- for (j = 0; doGen && j < this.waterlilyPerChunk; ++j)
- {
+ for (j = 0; doGen && j < this.waterlilyPerChunk; ++j) {
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
- for (i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2); i1 > 0 && this.currentWorld.isAirBlock(k, i1 - 1, l); --i1)
- {
+ for (i1 = nextInt(this.currentWorld.getHeightValue(k, l) * 2);
+ i1 > 0 && this.currentWorld.isAirBlock(k, i1 - 1, l);
+ --i1) {
;
}
@@ -194,18 +180,15 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, SHROOM);
- for (j = 0; doGen && j < this.mushroomsPerChunk; ++j)
- {
- if (this.randomGenerator.nextInt(4) == 0)
- {
+ for (j = 0; doGen && j < this.mushroomsPerChunk; ++j) {
+ if (this.randomGenerator.nextInt(4) == 0) {
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
i1 = this.currentWorld.getHeightValue(k, l);
this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
}
- if (this.randomGenerator.nextInt(8) == 0)
- {
+ if (this.randomGenerator.nextInt(8) == 0) {
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) * 2);
@@ -213,16 +196,14 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
}
- if (doGen && this.randomGenerator.nextInt(4) == 0)
- {
+ if (doGen && this.randomGenerator.nextInt(4) == 0) {
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
l = nextInt(this.currentWorld.getHeightValue(j, k) * 2);
this.mushroomBrownGen.generate(this.currentWorld, this.randomGenerator, j, l, k);
}
- if (doGen && this.randomGenerator.nextInt(8) == 0)
- {
+ if (doGen && this.randomGenerator.nextInt(8) == 0) {
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
l = nextInt(this.currentWorld.getHeightValue(j, k) * 2);
@@ -230,16 +211,14 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, REED);
- for (j = 0; doGen && j < this.reedsPerChunk; ++j)
- {
+ for (j = 0; doGen && j < this.reedsPerChunk; ++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) * 2);
this.reedGen.generate(this.currentWorld, this.randomGenerator, k, i1, l);
}
- for (j = 0; doGen && j < 10; ++j)
- {
+ for (j = 0; doGen && j < 10; ++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) * 2);
@@ -247,8 +226,7 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, PUMPKIN);
- if (doGen && this.randomGenerator.nextInt(32) == 0)
- {
+ if (doGen && this.randomGenerator.nextInt(32) == 0) {
j = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
k = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
l = nextInt(this.currentWorld.getHeightValue(j, k) * 2);
@@ -256,8 +234,7 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, CACTUS);
- for (j = 0; doGen && j < this.cactiPerChunk; ++j)
- {
+ for (j = 0; doGen && j < this.cactiPerChunk; ++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) * 2);
@@ -265,20 +242,18 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
}
doGen = TerrainGen.decorate(currentWorld, randomGenerator, chunk_X, chunk_Z, LAKE);
- if (doGen && this.generateLakes)
- {
- for (j = 0; j < 50; ++j)
- {
+ if (doGen && this.generateLakes) {
+ for (j = 0; j < 50; ++j) {
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
l = this.randomGenerator.nextInt(this.randomGenerator.nextInt(248) + 8);
i1 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
(new WorldGenLiquids(Blocks.flowing_water)).generate(this.currentWorld, this.randomGenerator, k, l, i1);
}
- for (j = 0; j < 20; ++j)
- {
+ for (j = 0; j < 20; ++j) {
k = this.chunk_X + this.randomGenerator.nextInt(16) + 8;
- l = this.randomGenerator.nextInt(this.randomGenerator.nextInt(this.randomGenerator.nextInt(240) + 8) + 8);
+ l = this.randomGenerator.nextInt(
+ this.randomGenerator.nextInt(this.randomGenerator.nextInt(240) + 8) + 8);
i1 = this.chunk_Z + this.randomGenerator.nextInt(16) + 8;
(new WorldGenLiquids(Blocks.flowing_lava)).generate(this.currentWorld, this.randomGenerator, k, l, i1);
}
@@ -291,10 +266,8 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
* Standard ore generation helper. Generates most ores.
*/
@Override
- protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_)
- {
- for (int l = 0; l < p_76795_1_; ++l)
- {
+ protected void genStandardOre1(int p_76795_1_, WorldGenerator p_76795_2_, int p_76795_3_, int p_76795_4_) {
+ for (int l = 0; l < p_76795_1_; ++l) {
int i1 = this.chunk_X + this.randomGenerator.nextInt(16);
int j1 = this.randomGenerator.nextInt(p_76795_4_ - p_76795_3_) + p_76795_3_;
int k1 = this.chunk_Z + this.randomGenerator.nextInt(16);
@@ -306,12 +279,12 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
* Standard ore generation helper. Generates Lapis Lazuli.
*/
@Override
- protected void genStandardOre2(int p_76793_1_, WorldGenerator p_76793_2_, int p_76793_3_, int p_76793_4_)
- {
- for (int l = 0; l < p_76793_1_; ++l)
- {
+ protected void genStandardOre2(int p_76793_1_, WorldGenerator p_76793_2_, int p_76793_3_, int p_76793_4_) {
+ for (int l = 0; l < p_76793_1_; ++l) {
int i1 = this.chunk_X + this.randomGenerator.nextInt(16);
- int j1 = this.randomGenerator.nextInt(p_76793_4_) + this.randomGenerator.nextInt(p_76793_4_) + (p_76793_3_ - p_76793_4_);
+ int j1 = this.randomGenerator.nextInt(p_76793_4_)
+ + this.randomGenerator.nextInt(p_76793_4_)
+ + (p_76793_3_ - p_76793_4_);
int k1 = this.chunk_Z + this.randomGenerator.nextInt(16);
p_76793_2_.generate(this.currentWorld, this.randomGenerator, i1, j1, k1);
}
@@ -321,31 +294,29 @@ public class BiomeGenerator_Custom extends BiomeDecorator {
* Generates ores in the current chunk
*/
@Override
- protected void generateOres()
- {
+ protected void generateOres() {
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Pre(currentWorld, randomGenerator, chunk_X, chunk_Z));
if (TerrainGen.generateOre(currentWorld, randomGenerator, dirtGen, chunk_X, chunk_Z, DIRT))
- this.genStandardOre1(20, this.dirtGen, 0, 256);
+ this.genStandardOre1(20, this.dirtGen, 0, 256);
if (TerrainGen.generateOre(currentWorld, randomGenerator, gravelGen, chunk_X, chunk_Z, GRAVEL))
- this.genStandardOre1(10, this.gravelGen, 0, 256);
+ this.genStandardOre1(10, this.gravelGen, 0, 256);
if (TerrainGen.generateOre(currentWorld, randomGenerator, coalGen, chunk_X, chunk_Z, COAL))
- this.genStandardOre1(20, this.coalGen, 0, 128);
+ this.genStandardOre1(20, this.coalGen, 0, 128);
if (TerrainGen.generateOre(currentWorld, randomGenerator, ironGen, chunk_X, chunk_Z, IRON))
- this.genStandardOre1(20, this.ironGen, 0, 64);
+ this.genStandardOre1(20, this.ironGen, 0, 64);
if (TerrainGen.generateOre(currentWorld, randomGenerator, goldGen, chunk_X, chunk_Z, GOLD))
- this.genStandardOre1(2, this.goldGen, 0, 32);
+ this.genStandardOre1(2, this.goldGen, 0, 32);
if (TerrainGen.generateOre(currentWorld, randomGenerator, redstoneGen, chunk_X, chunk_Z, REDSTONE))
- this.genStandardOre1(8, this.redstoneGen, 0, 16);
+ this.genStandardOre1(8, this.redstoneGen, 0, 16);
if (TerrainGen.generateOre(currentWorld, randomGenerator, diamondGen, chunk_X, chunk_Z, DIAMOND))
- this.genStandardOre1(1, this.diamondGen, 0, 16);
+ this.genStandardOre1(1, this.diamondGen, 0, 16);
if (TerrainGen.generateOre(currentWorld, randomGenerator, lapisGen, chunk_X, chunk_Z, LAPIS))
- this.genStandardOre2(1, this.lapisGen, 16, 16);
+ this.genStandardOre2(1, this.lapisGen, 16, 16);
MinecraftForge.ORE_GEN_BUS.post(new OreGenEvent.Post(currentWorld, randomGenerator, chunk_X, chunk_Z));
}
private int nextInt(int i) {
- if (i <= 1)
- return 0;
+ if (i <= 1) return 0;
return this.randomGenerator.nextInt(i);
- }
-} \ No newline at end of file
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/biome/Biome_Everglades.java b/src/main/java/gtPlusPlus/everglades/biome/Biome_Everglades.java
index b31f6d034e..214b86d196 100644
--- a/src/main/java/gtPlusPlus/everglades/biome/Biome_Everglades.java
+++ b/src/main/java/gtPlusPlus/everglades/biome/Biome_Everglades.java
@@ -1,150 +1,141 @@
package gtPlusPlus.everglades.biome;
-import java.lang.reflect.Field;
-import java.util.Random;
-
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
-import net.minecraft.entity.monster.EntityPigZombie;
-import net.minecraft.entity.passive.EntityBat;
-import net.minecraft.entity.passive.EntitySquid;
-import net.minecraft.item.ItemStack;
-import net.minecraft.world.World;
-import net.minecraft.world.biome.BiomeGenBase;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.entity.monster.EntitySickBlaze;
import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.everglades.dimension.Dimension_Everglades;
+import java.lang.reflect.Field;
+import java.util.Random;
+import net.minecraft.entity.monster.EntityPigZombie;
+import net.minecraft.entity.passive.EntityBat;
+import net.minecraft.entity.passive.EntitySquid;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeManager;
public class Biome_Everglades {
- public static BiomeGenEverglades biome = new BiomeGenEverglades();
-
- public Object instance;
-
- public Biome_Everglades() {
- }
-
- public void load() {
- BiomeDictionary.registerBiomeType(biome, BiomeDictionary.Type.DEAD);
- BiomeManager.addSpawnBiome(biome);
- }
-
- public void generateNether(World world, Random random, int chunkX, int chunkZ) {
- }
-
- public void generateSurface(World world, Random random, int chunkX, int chunkZ) {
- }
-
- public void registerRenderers() {
- }
-
- public int addFuel(ItemStack fuel) {
- return 0;
- }
-
- public void serverLoad(FMLServerStartingEvent event) {
- }
-
- public void preInit(FMLPreInitializationEvent event) {
- }
-
- static class BiomeGenEverglades extends BiomeGenBase {
- @SuppressWarnings("unchecked")
- public BiomeGenEverglades() {
- super(CORE.EVERGLADESBIOME_ID);
- //this.setBiomeID();
- this.theBiomeDecorator = new BiomeGenerator_Custom();
- this.theBiomeDecorator.treesPerChunk = 10;
- //Logger.INFO("Dark World Temperature Category: "+getTempCategory());
- this.setBiomeName("Toxic Everglades");
- this.topBlock = Dimension_Everglades.blockTopLayer;
- this.fillerBlock = Dimension_Everglades.blockSecondLayer;
- this.enableRain = true;
- this.enableSnow = false;
- this.rainfall = 0.7F;
- this.setHeight(new BiomeGenBase.Height(0.3F, 0.5F));
- this.heightVariation = 0.4F;
- this.waterColorMultiplier = 0x17290A;
- this.rootHeight = -0.25f; //Ground level
-
- this.spawnableMonsterList.clear();
- this.spawnableCreatureList.clear();
- this.spawnableWaterCreatureList.clear();
- this.spawnableCaveCreatureList.clear();
-
- //Enemies
- this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySickBlaze.class, 100, 2, 6));
- this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 75, 4, 16));
- this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityStaballoyConstruct.class, 20, 1, 2));
-
- //Animals
- this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 1, 1, 6));
- this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8));
-
- }
-
- private synchronized boolean setBiomeID() {
- try {
- Field mInternalBiomeList = ReflectionUtils.getField(BiomeGenBase.class, "biomeList");
- Field mClone = mInternalBiomeList;
- BiomeGenBase[] mOriginalList = (BiomeGenBase[]) mInternalBiomeList.get(null);
- BiomeGenBase[] mTempList = new BiomeGenBase[mOriginalList.length];
- for (int index=0;index<mTempList.length;index++) {
- mTempList[index] = mOriginalList[index];
- }
- if (mTempList != null){
- mTempList[CORE.AUSTRALIA_BIOME_DESERT_1_ID] = this;
- mInternalBiomeList.set(null, mTempList);
- if (mTempList != mInternalBiomeList.get(null)){
- ReflectionUtils.setFinalFieldValue(BiomeGenBase.class, mInternalBiomeList, mTempList);
- Logger.REFLECTION("Set Biome ID for "+this.biomeName+" Biome internally in 'biomeList' field from "+BiomeGenBase.class.getCanonicalName()+".");
- return true;
- }
- else {
- Logger.REFLECTION("Failed to set Biome ID for "+this.biomeName+" Biome internally in 'biomeList' field from "+BiomeGenBase.class.getCanonicalName()+".");
- }
- }
- return false;
- }
- catch (Exception e) {
- Logger.REFLECTION("Could not access 'biomeList' field in "+BiomeGenBase.class.getCanonicalName()+".");
- e.printStackTrace();
- return false;
- }
- }
-
- @SideOnly(Side.CLIENT)
- public int getBiomeGrassColor() {
- return 0x111f11;
- }
-
- @SideOnly(Side.CLIENT)
- public int getBiomeFoliageColor() {
- return 0x111f11;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public int getSkyColorByTemp(float par1) {
- return 0xF67A14;
- }
-
- @SuppressWarnings({ "unchecked", "unused" })
- private boolean addToMonsterSpawnLists(Class<?> EntityClass, int a, int b, int c){
- //this.spawnableMonsterList.add(new SpawnListEntry(EntityClass, a, b, c));
- this.spawnableCaveCreatureList.add(new SpawnListEntry(EntityClass, a, b, c));
- return true;
- }
-
- }
-
+ public static BiomeGenEverglades biome = new BiomeGenEverglades();
+
+ public Object instance;
+
+ public Biome_Everglades() {}
+
+ public void load() {
+ BiomeDictionary.registerBiomeType(biome, BiomeDictionary.Type.DEAD);
+ BiomeManager.addSpawnBiome(biome);
+ }
+
+ public void generateNether(World world, Random random, int chunkX, int chunkZ) {}
+
+ public void generateSurface(World world, Random random, int chunkX, int chunkZ) {}
+
+ public void registerRenderers() {}
+
+ public int addFuel(ItemStack fuel) {
+ return 0;
+ }
+
+ public void serverLoad(FMLServerStartingEvent event) {}
+
+ public void preInit(FMLPreInitializationEvent event) {}
+
+ static class BiomeGenEverglades extends BiomeGenBase {
+ @SuppressWarnings("unchecked")
+ public BiomeGenEverglades() {
+ super(CORE.EVERGLADESBIOME_ID);
+ // this.setBiomeID();
+ this.theBiomeDecorator = new BiomeGenerator_Custom();
+ this.theBiomeDecorator.treesPerChunk = 10;
+ // Logger.INFO("Dark World Temperature Category: "+getTempCategory());
+ this.setBiomeName("Toxic Everglades");
+ this.topBlock = Dimension_Everglades.blockTopLayer;
+ this.fillerBlock = Dimension_Everglades.blockSecondLayer;
+ this.enableRain = true;
+ this.enableSnow = false;
+ this.rainfall = 0.7F;
+ this.setHeight(new BiomeGenBase.Height(0.3F, 0.5F));
+ this.heightVariation = 0.4F;
+ this.waterColorMultiplier = 0x17290A;
+ this.rootHeight = -0.25f; // Ground level
+
+ this.spawnableMonsterList.clear();
+ this.spawnableCreatureList.clear();
+ this.spawnableWaterCreatureList.clear();
+ this.spawnableCaveCreatureList.clear();
+
+ // Enemies
+ this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySickBlaze.class, 100, 2, 6));
+ this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityPigZombie.class, 75, 4, 16));
+ this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityStaballoyConstruct.class, 20, 1, 2));
+
+ // Animals
+ this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 1, 1, 6));
+ this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8));
+ }
+
+ private synchronized boolean setBiomeID() {
+ try {
+ Field mInternalBiomeList = ReflectionUtils.getField(BiomeGenBase.class, "biomeList");
+ Field mClone = mInternalBiomeList;
+ BiomeGenBase[] mOriginalList = (BiomeGenBase[]) mInternalBiomeList.get(null);
+ BiomeGenBase[] mTempList = new BiomeGenBase[mOriginalList.length];
+ for (int index = 0; index < mTempList.length; index++) {
+ mTempList[index] = mOriginalList[index];
+ }
+ if (mTempList != null) {
+ mTempList[CORE.AUSTRALIA_BIOME_DESERT_1_ID] = this;
+ mInternalBiomeList.set(null, mTempList);
+ if (mTempList != mInternalBiomeList.get(null)) {
+ ReflectionUtils.setFinalFieldValue(BiomeGenBase.class, mInternalBiomeList, mTempList);
+ Logger.REFLECTION(
+ "Set Biome ID for " + this.biomeName + " Biome internally in 'biomeList' field from "
+ + BiomeGenBase.class.getCanonicalName() + ".");
+ return true;
+ } else {
+ Logger.REFLECTION("Failed to set Biome ID for " + this.biomeName
+ + " Biome internally in 'biomeList' field from " + BiomeGenBase.class.getCanonicalName()
+ + ".");
+ }
+ }
+ return false;
+ } catch (Exception e) {
+ Logger.REFLECTION(
+ "Could not access 'biomeList' field in " + BiomeGenBase.class.getCanonicalName() + ".");
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getBiomeGrassColor() {
+ return 0x111f11;
+ }
+
+ @SideOnly(Side.CLIENT)
+ public int getBiomeFoliageColor() {
+ return 0x111f11;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getSkyColorByTemp(float par1) {
+ return 0xF67A14;
+ }
+
+ @SuppressWarnings({"unchecked", "unused"})
+ private boolean addToMonsterSpawnLists(Class<?> EntityClass, int a, int b, int c) {
+ // this.spawnableMonsterList.add(new SpawnListEntry(EntityClass, a, b, c));
+ this.spawnableCaveCreatureList.add(new SpawnListEntry(EntityClass, a, b, c));
+ return true;
+ }
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/biome/GenLayerBiomes.java b/src/main/java/gtPlusPlus/everglades/biome/GenLayerBiomes.java
index b69a8ea555..9a84d6cc99 100644
--- a/src/main/java/gtPlusPlus/everglades/biome/GenLayerBiomes.java
+++ b/src/main/java/gtPlusPlus/everglades/biome/GenLayerBiomes.java
@@ -6,26 +6,28 @@ import net.minecraft.world.gen.layer.IntCache;
public class GenLayerBiomes extends GenLayer {
- protected BiomeGenBase[] allowedBiomes = { Biome_Everglades.biome, };
+ protected BiomeGenBase[] allowedBiomes = {
+ Biome_Everglades.biome,
+ };
- public GenLayerBiomes(long seed) {
- super(seed);
- }
+ public GenLayerBiomes(long seed) {
+ super(seed);
+ }
- public GenLayerBiomes(long seed, GenLayer genlayer) {
- super(seed);
- this.parent = genlayer;
- }
+ public GenLayerBiomes(long seed, GenLayer genlayer) {
+ super(seed);
+ this.parent = genlayer;
+ }
- @Override
- public int[] getInts(int x, int z, int width, int depth) {
- int[] dest = IntCache.getIntCache(width * depth);
- for (int dz = 0; dz < depth; dz++) {
- for (int dx = 0; dx < width; dx++) {
- this.initChunkSeed(dx + x, dz + z);
- dest[(dx + dz * width)] = this.allowedBiomes[nextInt(this.allowedBiomes.length)].biomeID;
- }
- }
- return dest;
- }
-} \ No newline at end of file
+ @Override
+ public int[] getInts(int x, int z, int width, int depth) {
+ int[] dest = IntCache.getIntCache(width * depth);
+ for (int dz = 0; dz < depth; dz++) {
+ for (int dx = 0; dx < width; dx++) {
+ this.initChunkSeed(dx + x, dz + z);
+ dest[(dx + dz * width)] = this.allowedBiomes[nextInt(this.allowedBiomes.length)].biomeID;
+ }
+ }
+ return dest;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/biome/GenLayerEverglades.java b/src/main/java/gtPlusPlus/everglades/biome/GenLayerEverglades.java
index 8034921dce..59b4924355 100644
--- a/src/main/java/gtPlusPlus/everglades/biome/GenLayerEverglades.java
+++ b/src/main/java/gtPlusPlus/everglades/biome/GenLayerEverglades.java
@@ -7,26 +7,26 @@ import net.minecraft.world.gen.layer.GenLayerZoom;
public class GenLayerEverglades extends GenLayer {
- public GenLayerEverglades(long seed) {
- super(seed);
- }
+ public GenLayerEverglades(long seed) {
+ super(seed);
+ }
- public static GenLayer[] makeTheWorld(long seed, WorldType type) {
- GenLayer biomes = new GenLayerBiomes(1L);
- biomes = new GenLayerZoom(1000L, biomes);
- biomes = new GenLayerZoom(1001L, biomes);
- biomes = new GenLayerZoom(1002L, biomes);
- biomes = new GenLayerZoom(1003L, biomes);
- biomes = new GenLayerZoom(1004L, biomes);
- biomes = new GenLayerZoom(1005L, biomes);
- GenLayer genlayervoronoizoom = new GenLayerVoronoiZoom(10L, biomes);
- biomes.initWorldGenSeed(seed);
- genlayervoronoizoom.initWorldGenSeed(seed);
- return new GenLayer[] { biomes, genlayervoronoizoom };
- }
+ public static GenLayer[] makeTheWorld(long seed, WorldType type) {
+ GenLayer biomes = new GenLayerBiomes(1L);
+ biomes = new GenLayerZoom(1000L, biomes);
+ biomes = new GenLayerZoom(1001L, biomes);
+ biomes = new GenLayerZoom(1002L, biomes);
+ biomes = new GenLayerZoom(1003L, biomes);
+ biomes = new GenLayerZoom(1004L, biomes);
+ biomes = new GenLayerZoom(1005L, biomes);
+ GenLayer genlayervoronoizoom = new GenLayerVoronoiZoom(10L, biomes);
+ biomes.initWorldGenSeed(seed);
+ genlayervoronoizoom.initWorldGenSeed(seed);
+ return new GenLayer[] {biomes, genlayervoronoizoom};
+ }
- @Override
- public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_) {
- return new int[] {};
- }
-} \ No newline at end of file
+ @Override
+ public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_) {
+ return new int[] {};
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldGround.java b/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldGround.java
index f68c97b3c5..85154ef1fb 100644
--- a/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldGround.java
+++ b/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldGround.java
@@ -1,25 +1,22 @@
package gtPlusPlus.everglades.block;
import cpw.mods.fml.common.registry.LanguageRegistry;
-
-import net.minecraft.block.BlockGrass;
-
import gtPlusPlus.api.interfaces.ITileTooltip;
import gtPlusPlus.core.creative.AddToCreativeTab;
+import net.minecraft.block.BlockGrass;
-public class BlockDarkWorldGround extends BlockGrass implements ITileTooltip{
-
- public BlockDarkWorldGround() {
- this.setCreativeTab(AddToCreativeTab.tabBOP);
- this.setBlockName("blockDarkWorldGround");
- this.setHardness(1.0F);
- this.setBlockTextureName("minecraft" + ":" + "grass");
- LanguageRegistry.addName(this, "Unstable Earth");
- }
+public class BlockDarkWorldGround extends BlockGrass implements ITileTooltip {
- @Override
- public int getTooltipID() {
- return 2;
- }
+ public BlockDarkWorldGround() {
+ this.setCreativeTab(AddToCreativeTab.tabBOP);
+ this.setBlockName("blockDarkWorldGround");
+ this.setHardness(1.0F);
+ this.setBlockTextureName("minecraft" + ":" + "grass");
+ LanguageRegistry.addName(this, "Unstable Earth");
+ }
+ @Override
+ public int getTooltipID() {
+ return 2;
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPollutedDirt.java b/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPollutedDirt.java
index a1fcc588b5..043f632804 100644
--- a/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPollutedDirt.java
+++ b/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPollutedDirt.java
@@ -3,72 +3,66 @@ package gtPlusPlus.everglades.block;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import gtPlusPlus.api.interfaces.ITileTooltip;
+import gtPlusPlus.core.creative.AddToCreativeTab;
import net.minecraft.block.BlockDirt;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
-import gtPlusPlus.api.interfaces.ITileTooltip;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-
-public class BlockDarkWorldPollutedDirt extends BlockDirt implements ITileTooltip{
+public class BlockDarkWorldPollutedDirt extends BlockDirt implements ITileTooltip {
- public BlockDarkWorldPollutedDirt() {
- this.setCreativeTab(AddToCreativeTab.tabBOP);
- this.setBlockName("blockDarkWorldGround2");
- this.setHardness(0.5F);
- this.setBlockTextureName("minecraft" + ":" + "dirt");
- LanguageRegistry.addName(this, "Polluted Soil");
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public int getBlockColor()
- {
- double d0 = 0.5D;
- double d1 = 1.0D;
- return ColorizerGrass.getGrassColor(d0, d1);
- }
+ public BlockDarkWorldPollutedDirt() {
+ this.setCreativeTab(AddToCreativeTab.tabBOP);
+ this.setBlockName("blockDarkWorldGround2");
+ this.setHardness(0.5F);
+ this.setBlockTextureName("minecraft" + ":" + "dirt");
+ LanguageRegistry.addName(this, "Polluted Soil");
+ }
- /**
- * Returns the color this block should be rendered. Used by leaves.
- */
- @Override
- @SideOnly(Side.CLIENT)
- public int getRenderColor(int p_149741_1_)
- {
- return this.getBlockColor();
- }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getBlockColor() {
+ double d0 = 0.5D;
+ double d1 = 1.0D;
+ return ColorizerGrass.getGrassColor(d0, d1);
+ }
- /**
- * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
- * when first determining what to render.
- */
- @Override
- @SideOnly(Side.CLIENT)
- public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_)
- {
- int l = 0;
- int i1 = 0;
- int j1 = 0;
+ /**
+ * Returns the color this block should be rendered. Used by leaves.
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int getRenderColor(int p_149741_1_) {
+ return this.getBlockColor();
+ }
- for (int k1 = -1; k1 <= 1; ++k1)
- {
- for (int l1 = -1; l1 <= 1; ++l1)
- {
- int i2 = p_149720_1_.getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1).getBiomeGrassColor(p_149720_2_ + l1, p_149720_3_, p_149720_4_ + k1);
- l += (i2 & 16711680) >> 16;
- i1 += (i2 & 65280) >> 8;
- j1 += i2 & 255;
- }
- }
+ /**
+ * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called
+ * when first determining what to render.
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) {
+ int l = 0;
+ int i1 = 0;
+ int j1 = 0;
- return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255;
- }
+ for (int k1 = -1; k1 <= 1; ++k1) {
+ for (int l1 = -1; l1 <= 1; ++l1) {
+ int i2 = p_149720_1_
+ .getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1)
+ .getBiomeGrassColor(p_149720_2_ + l1, p_149720_3_, p_149720_4_ + k1);
+ l += (i2 & 16711680) >> 16;
+ i1 += (i2 & 65280) >> 8;
+ j1 += i2 & 255;
+ }
+ }
- @Override
- public int getTooltipID() {
- return 3;
- }
+ return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255;
+ }
+ @Override
+ public int getTooltipID() {
+ return 3;
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPortalFrame.java b/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPortalFrame.java
index 09dea46ab1..96f32be8a1 100644
--- a/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPortalFrame.java
+++ b/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldPortalFrame.java
@@ -1,30 +1,26 @@
package gtPlusPlus.everglades.block;
import cpw.mods.fml.common.registry.LanguageRegistry;
-
-import net.minecraft.block.Block;
-import net.minecraft.block.material.Material;
-
import gtPlusPlus.api.interfaces.ITileTooltip;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
+import net.minecraft.block.Block;
+import net.minecraft.block.material.Material;
-public class BlockDarkWorldPortalFrame extends Block implements ITileTooltip{
-
- public BlockDarkWorldPortalFrame() {
- super(Material.iron);
- this.setCreativeTab(AddToCreativeTab.tabBOP);
- this.setBlockName("blockDarkWorldPortalFrame");
- this.setHardness(3.0F);
- this.setLightLevel(0.5F);
- this.setBlockTextureName(CORE.MODID + ":" + "metro/TEXTURE_TECH_PANEL_A");
- LanguageRegistry.addName(this, "Containment Frame");
-
- }
-
- @Override
- public int getTooltipID() {
- return 0;
- }
-
+public class BlockDarkWorldPortalFrame extends Block implements ITileTooltip {
+
+ public BlockDarkWorldPortalFrame() {
+ super(Material.iron);
+ this.setCreativeTab(AddToCreativeTab.tabBOP);
+ this.setBlockName("blockDarkWorldPortalFrame");
+ this.setHardness(3.0F);
+ this.setLightLevel(0.5F);
+ this.setBlockTextureName(CORE.MODID + ":" + "metro/TEXTURE_TECH_PANEL_A");
+ LanguageRegistry.addName(this, "Containment Frame");
+ }
+
+ @Override
+ public int getTooltipID() {
+ return 0;
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldSludgeFluid.java b/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldSludgeFluid.java
index 3c0445c86d..155319deaa 100644
--- a/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldSludgeFluid.java
+++ b/src/main/java/gtPlusPlus/everglades/block/BlockDarkWorldSludgeFluid.java
@@ -3,99 +3,89 @@ package gtPlusPlus.everglades.block;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialLiquid;
-
import net.minecraftforge.fluids.Fluid;
public class BlockDarkWorldSludgeFluid extends Fluid {
-
- public static final Material SLUDGE = new MaterialLiquid(MapColor.dirtColor);
-
- protected static int mapColor = 0xFFFFFFFF;
- protected static float overlayAlpha = 0.2F;
- //protected static SoundEvent emptySound = SoundEvents.ITEM_BUCKET_EMPTY;
- //protected static SoundEvent fillSound = SoundEvents.ITEM_BUCKET_FILL;
- protected static Material material = SLUDGE;
-
-
- public BlockDarkWorldSludgeFluid(String fluidName, int rgbColour) {
- this(fluidName, rgbColour, null);
- }
-
- public BlockDarkWorldSludgeFluid(String fluidName, int rgbColour, Float overlayAlpha) {
- super(fluidName);
- setColor(rgbColour);
- if (overlayAlpha != null){
- setAlpha(overlayAlpha.floatValue());
- }
- else {
- setAlpha(0);
- }
- }
-
- @Override
- public int getColor()
- {
- return mapColor;
- }
-
- public BlockDarkWorldSludgeFluid setColor(int parColor)
- {
- mapColor = parColor;
- return this;
- }
-
- public float getAlpha()
- {
- return overlayAlpha;
- }
-
- public BlockDarkWorldSludgeFluid setAlpha(float parOverlayAlpha)
- {
- overlayAlpha = parOverlayAlpha;
- return this;
- }
-
- /*public blockDarkWorldSludgeFluid setEmptySound(SoundEvent parSound)
- {
- emptySound = parSound;
- return this;
- }
-
- public SoundEvent getEmptySound()
- {
- return emptySound;
- }
-
- @Override
- public blockDarkWorldSludgeFluid setFillSound(SoundEvent parSound)
- {
- fillSound = parSound;
- return this;
- }
-
- @Override
- public SoundEvent getFillSound()
- {
- return fillSound;
- }*/
-
- public BlockDarkWorldSludgeFluid setMaterial(Material parMaterial)
- {
- material = parMaterial;
- return this;
- }
-
- public Material getMaterial()
- {
- return material;
- }
-
- /*@Override
- public boolean doesVaporize(FluidStack fluidStack)
- {
- if (block == null)
- return false;
- return block.getDefaultState().getMaterial() == getMaterial();
- }*/
+ public static final Material SLUDGE = new MaterialLiquid(MapColor.dirtColor);
+
+ protected static int mapColor = 0xFFFFFFFF;
+ protected static float overlayAlpha = 0.2F;
+ // protected static SoundEvent emptySound = SoundEvents.ITEM_BUCKET_EMPTY;
+ // protected static SoundEvent fillSound = SoundEvents.ITEM_BUCKET_FILL;
+ protected static Material material = SLUDGE;
+
+ public BlockDarkWorldSludgeFluid(String fluidName, int rgbColour) {
+ this(fluidName, rgbColour, null);
+ }
+
+ public BlockDarkWorldSludgeFluid(String fluidName, int rgbColour, Float overlayAlpha) {
+ super(fluidName);
+ setColor(rgbColour);
+ if (overlayAlpha != null) {
+ setAlpha(overlayAlpha.floatValue());
+ } else {
+ setAlpha(0);
+ }
+ }
+
+ @Override
+ public int getColor() {
+ return mapColor;
+ }
+
+ public BlockDarkWorldSludgeFluid setColor(int parColor) {
+ mapColor = parColor;
+ return this;
+ }
+
+ public float getAlpha() {
+ return overlayAlpha;
+ }
+
+ public BlockDarkWorldSludgeFluid setAlpha(float parOverlayAlpha) {
+ overlayAlpha = parOverlayAlpha;
+ return this;
+ }
+
+ /*public blockDarkWorldSludgeFluid setEmptySound(SoundEvent parSound)
+ {
+ emptySound = parSound;
+ return this;
+ }
+
+ public SoundEvent getEmptySound()
+ {
+ return emptySound;
+ }
+
+ @Override
+ public blockDarkWorldSludgeFluid setFillSound(SoundEvent parSound)
+ {
+ fillSound = parSound;
+ return this;
+ }
+
+ @Override
+ public SoundEvent getFillSound()
+ {
+ return fillSound;
+ }*/
+
+ public BlockDarkWorldSludgeFluid setMaterial(Material parMaterial) {
+ material = parMaterial;
+ return this;
+ }
+
+ public Material getMaterial() {
+ return material;
+ }
+
+ /*@Override
+ public boolean doesVaporize(FluidStack fluidStack)
+ {
+ if (block == null)
+ return false;
+ return block.getDefaultState().getMaterial() == getMaterial();
+ }*/
}
diff --git a/src/main/java/gtPlusPlus/everglades/block/BlockEvergladesPortal.java b/src/main/java/gtPlusPlus/everglades/block/BlockEvergladesPortal.java
index e64968888d..d4385bc701 100644
--- a/src/main/java/gtPlusPlus/everglades/block/BlockEvergladesPortal.java
+++ b/src/main/java/gtPlusPlus/everglades/block/BlockEvergladesPortal.java
@@ -1,10 +1,15 @@
package gtPlusPlus.everglades.block;
-import java.util.Random;
-
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import gtPlusPlus.api.interfaces.ITileTooltip;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.minecraft.BlockPos;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.everglades.dimension.Dimension_Everglades;
+import gtPlusPlus.everglades.world.TeleporterDimensionMod;
+import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockBreakable;
import net.minecraft.block.material.Material;
@@ -19,385 +24,382 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-import gtPlusPlus.api.interfaces.ITileTooltip;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.minecraft.BlockPos;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.everglades.dimension.Dimension_Everglades;
-import gtPlusPlus.everglades.world.TeleporterDimensionMod;
-
-public class BlockEvergladesPortal extends BlockBreakable implements ITileTooltip{
- IIcon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null;
-
- public BlockEvergladesPortal() {
- super("portal", Material.portal, false);
- this.setTickRandomly(true);
- this.setHardness(-1.0F);
- this.setLightLevel(0.75F);
- this.setCreativeTab(CreativeTabs.tabBlock);
- this.setBlockName("blockDarkWorldPortal");
-
- }
-
- @SideOnly(Side.CLIENT)
- @Override
- public IIcon getIcon(int i, int par2) {
-
- if (i == 0)
- return gor;
-
- else if (i == 1)
- return dol;
-
- else if (i == 2)
- return st1;
-
- else if (i == 3)
- return st2;
-
- else if (i == 4)
- return st4;
-
- else if (i == 5)
- return st3;
-
- else
- return gor;
-
- }
-
- @SideOnly(Side.CLIENT)
- @Override
- public void registerBlockIcons(IIconRegister reg) {
- this.gor = reg.registerIcon("portal");
- this.dol = reg.registerIcon("portal");
- this.st1 = reg.registerIcon("portal");
- this.st2 = reg.registerIcon("portal");
- this.st3 = reg.registerIcon("portal");
- this.st4 = reg.registerIcon("portal");
- }
-
- /**
- * Ticks the block if it's been scheduled
- */
- @Override
- public void updateTick(World par1World, int x, int y, int z, Random par5Random) {
- super.updateTick(par1World, x, y, z, par5Random);
-
- int blockCount = 0;
- BlockPos portal = new BlockPos(x, y, z, par1World.provider.dimensionId);
-
- for (BlockPos side : portal.getSurroundingBlocks()) {
- Block b = side.getBlockAtPos();
- if (b == Dimension_Everglades.blockPortalFrame || b == Dimension_Everglades.portalBlock) {
- blockCount++;
- }
- }
- if (blockCount < 4) {
- par1World.setBlockToAir(x, y, z);
- }
-
- }
-
- /**
- * Returns a bounding box from the pool of bounding boxes (this means
- * this box can change after the pool has been cleared to be reused)
- */
- @Override
- public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
- return null;
- }
-
- /**
- * Updates the blocks bounds based on its current state. Args: world, x,
- * y, z
- */
- @Override
- public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
- float f;
- float f1;
- if (par1IBlockAccess.getBlock(par2 - 1, par3, par4) != this && par1IBlockAccess.getBlock(par2 + 1, par3, par4) != this) {
- f = 0.125F;
- f1 = 0.5F;
- this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
- } else {
- f = 0.5F;
- f1 = 0.125F;
- this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
- }
- }
-
- /**
- * Is this block (a) opaque and (B) a full 1m cube? This determines
- * whether or not to render the shared face of two adjacent blocks and
- * also whether the player can attach torches, redstone wire, etc to
- * this block.
- */
- @Override
- public boolean isOpaqueCube() {
- return false;
- }
-
- /**
- * If this block doesn't render as an ordinary block it will return
- * False (examples: signs, buttons, stairs, etc)
- */
- @Override
- public boolean renderAsNormalBlock() {
- return false;
- }
-
- /**
- * Checks to see if this location is valid to create a portal and will
- * return True if it does. Args: world, x, y, z
- */
- public boolean tryToCreatePortal(World par1World, int par2, int par3, int par4) {
- byte b0 = 0;
- byte b1 = 0;
- if (par1World.getBlock(par2 - 1, par3, par4) == Dimension_Everglades.blockPortalFrame
- || par1World.getBlock(par2 + 1, par3, par4) == Dimension_Everglades.blockPortalFrame) {
- b0 = 1;
- }
- if (par1World.getBlock(par2, par3, par4 - 1) == Dimension_Everglades.blockPortalFrame
- || par1World.getBlock(par2, par3, par4 + 1) == Dimension_Everglades.blockPortalFrame) {
- b1 = 1;
- }
- if (b0 == b1) {
- return false;
- } else {
- if (par1World.getBlock(par2 - b0, par3, par4 - b1) == Blocks.air) {
- par2 -= b0;
- par4 -= b1;
- }
- int l;
- int i1;
- for (l = -1; l <= 2; ++l) {
- for (i1 = -1; i1 <= 3; ++i1) {
- boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3;
- if (l != -1 && l != 2 || i1 != -1 && i1 != 3) {
- Block j1 = par1World.getBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l);
- if (flag) {
- if (j1 != Dimension_Everglades.blockPortalFrame) {
- return false;
- }
- }
- /*
- * else if (j1 != 0 && j1 !=
- * Main.TutorialFire.blockID) { return false; }
- */
- }
- }
- }
- for (l = 0; l < 2; ++l) {
- for (i1 = 0; i1 < 3; ++i1) {
- par1World.setBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l, this, 0, 2);
- }
- }
- return true;
- }
- }
-
- /**
- * Lets the block know when one of its neighbor changes. Doesn't know
- * which neighbor changed (coordinates passed are their own) Args: x, y,
- * z, neighbor blockID
- */
- public void onNeighborBlockChange(BlockPos pos) {
- int x = pos.xPos, y = pos.yPos, z = pos.zPos;
- Logger.INFO("Trigger");
- int blockCount = 0;
- BlockPos portal = pos;
- World par1World = portal.world;
- for (BlockPos side : portal.getSurroundingBlocks()) {
- Block b = side.getBlockAtPos();
- if (b == Dimension_Everglades.blockPortalFrame || b == Dimension_Everglades.portalBlock) {
- blockCount++;
- }
- }
- if (blockCount < 4) {
- par1World.setBlockToAir(x, y, z);
- par1World.scheduleBlockUpdate(x, y, z, portal.getBlockAtPos(), 0);
- }
-
-
-
- byte b0 = 0;
- byte b1 = 1;
- if (par1World.getBlock(x - 1, y, z) == this || par1World.getBlock(x + 1, y, z) == this) {
- b0 = 1;
- b1 = 0;
- }
- int i1;
- for (i1 = y; par1World.getBlock(x, i1 - 1, z) == this; --i1) {
- ;
- }
- if (par1World.getBlock(x, i1 - 1, z) != Dimension_Everglades.blockPortalFrame) {
- par1World.setBlockToAir(x, y, z);
- } else {
- int j1;
- for (j1 = 1; j1 < 4 && par1World.getBlock(x, i1 + j1, z) == this; ++j1) {
- ;
- }
- if (j1 == 3 && par1World.getBlock(x, i1 + j1, z) == Dimension_Everglades.blockPortalFrame) {
- boolean flag = par1World.getBlock(x - 1, y, z) == this || par1World.getBlock(x + 1, y, z) == this;
- boolean flag1 = par1World.getBlock(x, y, z - 1) == this || par1World.getBlock(x, y, z + 1) == this;
- if (flag && flag1) {
- par1World.setBlockToAir(x, y, z);
- } else {
- if ((par1World.getBlock(x + b0, y, z + b1) != Dimension_Everglades.blockPortalFrame || par1World
- .getBlock(x - b0, y, z - b1) != this)
- && (par1World.getBlock(x - b0, y, z - b1) != Dimension_Everglades.blockPortalFrame || par1World.getBlock(x + b0, y,
- z + b1) != this)) {
- par1World.setBlockToAir(x, y, z);
- }
- }
- } else {
- par1World.setBlockToAir(x, y, z);
- }
- }
- }
-
- @Override
- public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
- onNeighborBlockChange(new BlockPos(x, y, z, world.provider.dimensionId));
- super.onNeighborBlockChange(world, x, y, z, block);
- }
-
- /*@Override
- public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
- onNeighborBlockChange(new BlockPos(x, y, z, world.));
- super.onNeighborChange(world, x, y, z, tileX, tileY, tileZ);
- }*/
-
- @Override
- @SideOnly(Side.CLIENT)
- /**
- * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
- * coordinates. Args: blockAccess, x, y, z, side
- */
- public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
- if (par1IBlockAccess.getBlock(par2, par3, par4) == this) {
- return false;
- } else {
- boolean flag = par1IBlockAccess.getBlock(par2 - 1, par3, par4) == this && par1IBlockAccess.getBlock(par2 - 2, par3, par4) != this;
- boolean flag1 = par1IBlockAccess.getBlock(par2 + 1, par3, par4) == this && par1IBlockAccess.getBlock(par2 + 2, par3, par4) != this;
- boolean flag2 = par1IBlockAccess.getBlock(par2, par3, par4 - 1) == this && par1IBlockAccess.getBlock(par2, par3, par4 - 2) != this;
- boolean flag3 = par1IBlockAccess.getBlock(par2, par3, par4 + 1) == this && par1IBlockAccess.getBlock(par2, par3, par4 + 2) != this;
- boolean flag4 = flag || flag1;
- boolean flag5 = flag2 || flag3;
- return flag4 && par5 == 4 ? true : (flag4 && par5 == 5 ? true : (flag5 && par5 == 2 ? true : flag5 && par5 == 3));
- }
- }
-
- /**
- * Returns the quantity of items to drop on block destruction.
- */
- @Override
- public int quantityDropped(Random par1Random) {
- return 0;
- }
-
- /**
- * Triggered whenever an entity collides with this block (enters into
- * the block). Args: world, x, y, z, entity
- */
- @Override
- public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
- if ((par5Entity.ridingEntity == null) && (par5Entity.riddenByEntity == null) && ((par5Entity instanceof EntityPlayerMP))) {
- EntityPlayerMP thePlayer = (EntityPlayerMP) par5Entity;
- if (thePlayer.timeUntilPortal > 0) {
- thePlayer.timeUntilPortal = 100;
- } else if (thePlayer.dimension != Dimension_Everglades.DIMID) {
- thePlayer.timeUntilPortal = 100;
- thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Dimension_Everglades.DIMID,
- new TeleporterDimensionMod(thePlayer.mcServer.worldServerForDimension(Dimension_Everglades.DIMID)));
- } else {
- thePlayer.timeUntilPortal = 100;
- thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0,
- new TeleporterDimensionMod(thePlayer.mcServer.worldServerForDimension(0)));
- }
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- /**
- * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
- */
- public int getRenderBlockPass() {
- return 1;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- /**
- * A randomly called display update to be able to add particles or other items for display
- */
- public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
- if (CORE.RANDOM.nextInt(100) == 0) {
- par1World.playSound(par2 + 0.5D, par3 + 0.5D, par4 + 0.5D, "portal.portal", 0.5F,
- CORE.RANDOM.nextFloat() * 0.4F + 0.8F, false);
- }
- for (int l = 0; l < 4; ++l) {
- double d0 = par2 + CORE.RANDOM.nextFloat();
- double d1 = par3 + CORE.RANDOM.nextFloat();
- double d2 = par4 + CORE.RANDOM.nextFloat();
- double d3 = 0.0D;
- double d4 = 0.0D;
- double d5 = 0.0D;
- int i1 = CORE.RANDOM.nextInt(2) * 2 - 1;
- d3 = (CORE.RANDOM.nextFloat() - 0.5D) * 0.5D;
- d4 = (CORE.RANDOM.nextFloat() - 0.5D) * 0.5D;
- d5 = (CORE.RANDOM.nextFloat() - 0.5D) * 0.5D;
- if (par1World.getBlock(par2 - 1, par3, par4) != this && par1World.getBlock(par2 + 1, par3, par4) != this) {
- d0 = par2 + 0.5D + 0.25D * i1;
- d3 = CORE.RANDOM.nextFloat() * 2.0F * i1;
- } else {
- d2 = par4 + 0.5D + 0.25D * i1;
- d5 = CORE.RANDOM.nextFloat() * 2.0F * i1;
- }
- par1World.spawnParticle("reddust", d0+0.1D, d1, d2, d3, d4, d5);
- par1World.spawnParticle("smoke", d0, d1+0.1D, d2, 0, 0, 0);
-
- Random R = new Random();
-
- if (R.nextInt(10) == 0){
- par1World.spawnParticle("largesmoke", d0, d1, d2, 0, 0+0.2D, 0);
- }
- else if (R.nextInt(5)==1){
- par1World.spawnParticle("flame", d0, d1, d2, 0, 0+0.1D, 0);
- }
- }
- }
-
- @SideOnly(Side.CLIENT)
- /**
- * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
- */
- public int idPicked(World par1World, int par2, int par3, int par4) {
- return 0;
- }
-
- @Override
- public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){
- return Utils.rgbtoHexValue(0, 255, 0);
- }
-
- @Override
- public int getRenderColor(final int aMeta) {
- return Utils.rgbtoHexValue(0, 255, 0);
- }
-
- @Override
- public String getLocalizedName() {
- return EnumChatFormatting.OBFUSCATED+super.getLocalizedName();
- }
-
- @Override
- public int getTooltipID() {
- return 1;
- }
+public class BlockEvergladesPortal extends BlockBreakable implements ITileTooltip {
+ IIcon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null;
+
+ public BlockEvergladesPortal() {
+ super("portal", Material.portal, false);
+ this.setTickRandomly(true);
+ this.setHardness(-1.0F);
+ this.setLightLevel(0.75F);
+ this.setCreativeTab(CreativeTabs.tabBlock);
+ this.setBlockName("blockDarkWorldPortal");
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public IIcon getIcon(int i, int par2) {
+
+ if (i == 0) return gor;
+ else if (i == 1) return dol;
+ else if (i == 2) return st1;
+ else if (i == 3) return st2;
+ else if (i == 4) return st4;
+ else if (i == 5) return st3;
+ else return gor;
+ }
+
+ @SideOnly(Side.CLIENT)
+ @Override
+ public void registerBlockIcons(IIconRegister reg) {
+ this.gor = reg.registerIcon("portal");
+ this.dol = reg.registerIcon("portal");
+ this.st1 = reg.registerIcon("portal");
+ this.st2 = reg.registerIcon("portal");
+ this.st3 = reg.registerIcon("portal");
+ this.st4 = reg.registerIcon("portal");
+ }
+
+ /**
+ * Ticks the block if it's been scheduled
+ */
+ @Override
+ public void updateTick(World par1World, int x, int y, int z, Random par5Random) {
+ super.updateTick(par1World, x, y, z, par5Random);
+
+ int blockCount = 0;
+ BlockPos portal = new BlockPos(x, y, z, par1World.provider.dimensionId);
+
+ for (BlockPos side : portal.getSurroundingBlocks()) {
+ Block b = side.getBlockAtPos();
+ if (b == Dimension_Everglades.blockPortalFrame || b == Dimension_Everglades.portalBlock) {
+ blockCount++;
+ }
+ }
+ if (blockCount < 4) {
+ par1World.setBlockToAir(x, y, z);
+ }
+ }
+
+ /**
+ * Returns a bounding box from the pool of bounding boxes (this means
+ * this box can change after the pool has been cleared to be reused)
+ */
+ @Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
+ return null;
+ }
+
+ /**
+ * Updates the blocks bounds based on its current state. Args: world, x,
+ * y, z
+ */
+ @Override
+ public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
+ float f;
+ float f1;
+ if (par1IBlockAccess.getBlock(par2 - 1, par3, par4) != this
+ && par1IBlockAccess.getBlock(par2 + 1, par3, par4) != this) {
+ f = 0.125F;
+ f1 = 0.5F;
+ this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
+ } else {
+ f = 0.5F;
+ f1 = 0.125F;
+ this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1);
+ }
+ }
+
+ /**
+ * Is this block (a) opaque and (B) a full 1m cube? This determines
+ * whether or not to render the shared face of two adjacent blocks and
+ * also whether the player can attach torches, redstone wire, etc to
+ * this block.
+ */
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ /**
+ * If this block doesn't render as an ordinary block it will return
+ * False (examples: signs, buttons, stairs, etc)
+ */
+ @Override
+ public boolean renderAsNormalBlock() {
+ return false;
+ }
+
+ /**
+ * Checks to see if this location is valid to create a portal and will
+ * return True if it does. Args: world, x, y, z
+ */
+ public boolean tryToCreatePortal(World par1World, int par2, int par3, int par4) {
+ byte b0 = 0;
+ byte b1 = 0;
+ if (par1World.getBlock(par2 - 1, par3, par4) == Dimension_Everglades.blockPortalFrame
+ || par1World.getBlock(par2 + 1, par3, par4) == Dimension_Everglades.blockPortalFrame) {
+ b0 = 1;
+ }
+ if (par1World.getBlock(par2, par3, par4 - 1) == Dimension_Everglades.blockPortalFrame
+ || par1World.getBlock(par2, par3, par4 + 1) == Dimension_Everglades.blockPortalFrame) {
+ b1 = 1;
+ }
+ if (b0 == b1) {
+ return false;
+ } else {
+ if (par1World.getBlock(par2 - b0, par3, par4 - b1) == Blocks.air) {
+ par2 -= b0;
+ par4 -= b1;
+ }
+ int l;
+ int i1;
+ for (l = -1; l <= 2; ++l) {
+ for (i1 = -1; i1 <= 3; ++i1) {
+ boolean flag = l == -1 || l == 2 || i1 == -1 || i1 == 3;
+ if (l != -1 && l != 2 || i1 != -1 && i1 != 3) {
+ Block j1 = par1World.getBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l);
+ if (flag) {
+ if (j1 != Dimension_Everglades.blockPortalFrame) {
+ return false;
+ }
+ }
+ /*
+ * else if (j1 != 0 && j1 !=
+ * Main.TutorialFire.blockID) { return false; }
+ */
+ }
+ }
+ }
+ for (l = 0; l < 2; ++l) {
+ for (i1 = 0; i1 < 3; ++i1) {
+ par1World.setBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l, this, 0, 2);
+ }
+ }
+ return true;
+ }
+ }
+
+ /**
+ * Lets the block know when one of its neighbor changes. Doesn't know
+ * which neighbor changed (coordinates passed are their own) Args: x, y,
+ * z, neighbor blockID
+ */
+ public void onNeighborBlockChange(BlockPos pos) {
+ int x = pos.xPos, y = pos.yPos, z = pos.zPos;
+ Logger.INFO("Trigger");
+ int blockCount = 0;
+ BlockPos portal = pos;
+ World par1World = portal.world;
+ for (BlockPos side : portal.getSurroundingBlocks()) {
+ Block b = side.getBlockAtPos();
+ if (b == Dimension_Everglades.blockPortalFrame || b == Dimension_Everglades.portalBlock) {
+ blockCount++;
+ }
+ }
+ if (blockCount < 4) {
+ par1World.setBlockToAir(x, y, z);
+ par1World.scheduleBlockUpdate(x, y, z, portal.getBlockAtPos(), 0);
+ }
+
+ byte b0 = 0;
+ byte b1 = 1;
+ if (par1World.getBlock(x - 1, y, z) == this || par1World.getBlock(x + 1, y, z) == this) {
+ b0 = 1;
+ b1 = 0;
+ }
+ int i1;
+ for (i1 = y; par1World.getBlock(x, i1 - 1, z) == this; --i1) {
+ ;
+ }
+ if (par1World.getBlock(x, i1 - 1, z) != Dimension_Everglades.blockPortalFrame) {
+ par1World.setBlockToAir(x, y, z);
+ } else {
+ int j1;
+ for (j1 = 1; j1 < 4 && par1World.getBlock(x, i1 + j1, z) == this; ++j1) {
+ ;
+ }
+ if (j1 == 3 && par1World.getBlock(x, i1 + j1, z) == Dimension_Everglades.blockPortalFrame) {
+ boolean flag = par1World.getBlock(x - 1, y, z) == this || par1World.getBlock(x + 1, y, z) == this;
+ boolean flag1 = par1World.getBlock(x, y, z - 1) == this || par1World.getBlock(x, y, z + 1) == this;
+ if (flag && flag1) {
+ par1World.setBlockToAir(x, y, z);
+ } else {
+ if ((par1World.getBlock(x + b0, y, z + b1) != Dimension_Everglades.blockPortalFrame
+ || par1World.getBlock(x - b0, y, z - b1) != this)
+ && (par1World.getBlock(x - b0, y, z - b1) != Dimension_Everglades.blockPortalFrame
+ || par1World.getBlock(x + b0, y, z + b1) != this)) {
+ par1World.setBlockToAir(x, y, z);
+ }
+ }
+ } else {
+ par1World.setBlockToAir(x, y, z);
+ }
+ }
+ }
+
+ @Override
+ public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
+ onNeighborBlockChange(new BlockPos(x, y, z, world.provider.dimensionId));
+ super.onNeighborBlockChange(world, x, y, z, block);
+ }
+
+ /*@Override
+ public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ) {
+ onNeighborBlockChange(new BlockPos(x, y, z, world.));
+ super.onNeighborChange(world, x, y, z, tileX, tileY, tileZ);
+ }*/
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ /**
+ * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
+ * coordinates. Args: blockAccess, x, y, z, side
+ */
+ public boolean shouldSideBeRendered(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
+ if (par1IBlockAccess.getBlock(par2, par3, par4) == this) {
+ return false;
+ } else {
+ boolean flag = par1IBlockAccess.getBlock(par2 - 1, par3, par4) == this
+ && par1IBlockAccess.getBlock(par2 - 2, par3, par4) != this;
+ boolean flag1 = par1IBlockAccess.getBlock(par2 + 1, par3, par4) == this
+ && par1IBlockAccess.getBlock(par2 + 2, par3, par4) != this;
+ boolean flag2 = par1IBlockAccess.getBlock(par2, par3, par4 - 1) == this
+ && par1IBlockAccess.getBlock(par2, par3, par4 - 2) != this;
+ boolean flag3 = par1IBlockAccess.getBlock(par2, par3, par4 + 1) == this
+ && par1IBlockAccess.getBlock(par2, par3, par4 + 2) != this;
+ boolean flag4 = flag || flag1;
+ boolean flag5 = flag2 || flag3;
+ return flag4 && par5 == 4
+ ? true
+ : (flag4 && par5 == 5 ? true : (flag5 && par5 == 2 ? true : flag5 && par5 == 3));
+ }
+ }
+
+ /**
+ * Returns the quantity of items to drop on block destruction.
+ */
+ @Override
+ public int quantityDropped(Random par1Random) {
+ return 0;
+ }
+
+ /**
+ * Triggered whenever an entity collides with this block (enters into
+ * the block). Args: world, x, y, z, entity
+ */
+ @Override
+ public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
+ if ((par5Entity.ridingEntity == null)
+ && (par5Entity.riddenByEntity == null)
+ && ((par5Entity instanceof EntityPlayerMP))) {
+ EntityPlayerMP thePlayer = (EntityPlayerMP) par5Entity;
+ if (thePlayer.timeUntilPortal > 0) {
+ thePlayer.timeUntilPortal = 100;
+ } else if (thePlayer.dimension != Dimension_Everglades.DIMID) {
+ thePlayer.timeUntilPortal = 100;
+ thePlayer
+ .mcServer
+ .getConfigurationManager()
+ .transferPlayerToDimension(
+ thePlayer,
+ Dimension_Everglades.DIMID,
+ new TeleporterDimensionMod(
+ thePlayer.mcServer.worldServerForDimension(Dimension_Everglades.DIMID)));
+ } else {
+ thePlayer.timeUntilPortal = 100;
+ thePlayer
+ .mcServer
+ .getConfigurationManager()
+ .transferPlayerToDimension(
+ thePlayer,
+ 0,
+ new TeleporterDimensionMod(thePlayer.mcServer.worldServerForDimension(0)));
+ }
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ /**
+ * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha
+ */
+ public int getRenderBlockPass() {
+ return 1;
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ /**
+ * A randomly called display update to be able to add particles or other items for display
+ */
+ public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) {
+ if (CORE.RANDOM.nextInt(100) == 0) {
+ par1World.playSound(
+ par2 + 0.5D,
+ par3 + 0.5D,
+ par4 + 0.5D,
+ "portal.portal",
+ 0.5F,
+ CORE.RANDOM.nextFloat() * 0.4F + 0.8F,
+ false);
+ }
+ for (int l = 0; l < 4; ++l) {
+ double d0 = par2 + CORE.RANDOM.nextFloat();
+ double d1 = par3 + CORE.RANDOM.nextFloat();
+ double d2 = par4 + CORE.RANDOM.nextFloat();
+ double d3 = 0.0D;
+ double d4 = 0.0D;
+ double d5 = 0.0D;
+ int i1 = CORE.RANDOM.nextInt(2) * 2 - 1;
+ d3 = (CORE.RANDOM.nextFloat() - 0.5D) * 0.5D;
+ d4 = (CORE.RANDOM.nextFloat() - 0.5D) * 0.5D;
+ d5 = (CORE.RANDOM.nextFloat() - 0.5D) * 0.5D;
+ if (par1World.getBlock(par2 - 1, par3, par4) != this && par1World.getBlock(par2 + 1, par3, par4) != this) {
+ d0 = par2 + 0.5D + 0.25D * i1;
+ d3 = CORE.RANDOM.nextFloat() * 2.0F * i1;
+ } else {
+ d2 = par4 + 0.5D + 0.25D * i1;
+ d5 = CORE.RANDOM.nextFloat() * 2.0F * i1;
+ }
+ par1World.spawnParticle("reddust", d0 + 0.1D, d1, d2, d3, d4, d5);
+ par1World.spawnParticle("smoke", d0, d1 + 0.1D, d2, 0, 0, 0);
+
+ Random R = new Random();
+
+ if (R.nextInt(10) == 0) {
+ par1World.spawnParticle("largesmoke", d0, d1, d2, 0, 0 + 0.2D, 0);
+ } else if (R.nextInt(5) == 1) {
+ par1World.spawnParticle("flame", d0, d1, d2, 0, 0 + 0.1D, 0);
+ }
+ }
+ }
+
+ @SideOnly(Side.CLIENT)
+ /**
+ * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
+ */
+ public int idPicked(World par1World, int par2, int par3, int par4) {
+ return 0;
+ }
+
+ @Override
+ public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4) {
+ return Utils.rgbtoHexValue(0, 255, 0);
+ }
+
+ @Override
+ public int getRenderColor(final int aMeta) {
+ return Utils.rgbtoHexValue(0, 255, 0);
+ }
+
+ @Override
+ public String getLocalizedName() {
+ return EnumChatFormatting.OBFUSCATED + super.getLocalizedName();
+ }
+
+ @Override
+ public int getTooltipID() {
+ return 1;
+ }
}
-
-
diff --git a/src/main/java/gtPlusPlus/everglades/block/DarkWorldContentLoader.java b/src/main/java/gtPlusPlus/everglades/block/DarkWorldContentLoader.java
index 9d0e425e3a..86c7053dfc 100644
--- a/src/main/java/gtPlusPlus/everglades/block/DarkWorldContentLoader.java
+++ b/src/main/java/gtPlusPlus/everglades/block/DarkWorldContentLoader.java
@@ -3,69 +3,66 @@ package gtPlusPlus.everglades.block;
import static gtPlusPlus.everglades.dimension.Dimension_Everglades.*;
import cpw.mods.fml.common.registry.GameRegistry;
-
-import net.minecraft.init.Blocks;
-
import gtPlusPlus.core.block.base.BlockBaseFluid;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.everglades.item.ItemBlockToxicEverglades;
import gtPlusPlus.everglades.item.ItemEvergladesPortalTrigger;
+import net.minecraft.init.Blocks;
import net.minecraftforge.fluids.FluidRegistry;
public class DarkWorldContentLoader {
- //Static Vars
- public static BlockDarkWorldSludgeFluid SLUDGE;
-
-
- public synchronized static void run() {
- initMisc();
- initItems();
- initBlocks();
- }
-
- public synchronized static boolean initMisc(){
-
- //Fluids
- SLUDGE = (BlockDarkWorldSludgeFluid) new BlockDarkWorldSludgeFluid(
- "sludge",
- Utils.rgbtoHexValue(30, 130, 30))
- .setDensity(1800)
- .setGaseous(false)
- .setLuminosity(2)
- .setViscosity(25000)
- .setTemperature(300);
- FluidRegistry.registerFluid(SLUDGE);
-
- return true;
- }
-
- public synchronized static boolean initItems(){
- portalItem = (ItemEvergladesPortalTrigger) (new ItemEvergladesPortalTrigger().setUnlocalizedName("everglades.trigger"));
- GameRegistry.registerItem(portalItem, "everglades.trigger");
- return true;
- }
-
- public synchronized static boolean initBlocks(){
-
- //Create Block Instances
- blockFluidLakes = new BlockBaseFluid("Sludge", SLUDGE, BlockDarkWorldSludgeFluid.SLUDGE).setLightLevel(2f).setLightOpacity(1).setBlockName("fluidSludge");
- portalBlock = new BlockEvergladesPortal();
- blockTopLayer = new BlockDarkWorldGround();
- blockSecondLayer = new BlockDarkWorldPollutedDirt();
- blockPortalFrame = new BlockDarkWorldPortalFrame();
-
- //Registry
- GameRegistry.registerBlock(portalBlock, ItemBlockToxicEverglades.class, "dimensionDarkWorld_portal");
- GameRegistry.registerBlock(blockTopLayer, ItemBlockToxicEverglades.class, "blockDarkWorldGround");
- GameRegistry.registerBlock(blockSecondLayer, ItemBlockToxicEverglades.class, "blockDarkWorldGround2");
- GameRegistry.registerBlock(blockPortalFrame, ItemBlockToxicEverglades.class, "blockDarkWorldPortalFrame");
-
- //Make Flammable
- Blocks.fire.setFireInfo(blockTopLayer, 30, 20);
-
- return true;
- }
-
-
+ // Static Vars
+ public static BlockDarkWorldSludgeFluid SLUDGE;
+
+ public static synchronized void run() {
+ initMisc();
+ initItems();
+ initBlocks();
+ }
+
+ public static synchronized boolean initMisc() {
+
+ // Fluids
+ SLUDGE = (BlockDarkWorldSludgeFluid) new BlockDarkWorldSludgeFluid("sludge", Utils.rgbtoHexValue(30, 130, 30))
+ .setDensity(1800)
+ .setGaseous(false)
+ .setLuminosity(2)
+ .setViscosity(25000)
+ .setTemperature(300);
+ FluidRegistry.registerFluid(SLUDGE);
+
+ return true;
+ }
+
+ public static synchronized boolean initItems() {
+ portalItem = (ItemEvergladesPortalTrigger)
+ (new ItemEvergladesPortalTrigger().setUnlocalizedName("everglades.trigger"));
+ GameRegistry.registerItem(portalItem, "everglades.trigger");
+ return true;
+ }
+
+ public static synchronized boolean initBlocks() {
+
+ // Create Block Instances
+ blockFluidLakes = new BlockBaseFluid("Sludge", SLUDGE, BlockDarkWorldSludgeFluid.SLUDGE)
+ .setLightLevel(2f)
+ .setLightOpacity(1)
+ .setBlockName("fluidSludge");
+ portalBlock = new BlockEvergladesPortal();
+ blockTopLayer = new BlockDarkWorldGround();
+ blockSecondLayer = new BlockDarkWorldPollutedDirt();
+ blockPortalFrame = new BlockDarkWorldPortalFrame();
+
+ // Registry
+ GameRegistry.registerBlock(portalBlock, ItemBlockToxicEverglades.class, "dimensionDarkWorld_portal");
+ GameRegistry.registerBlock(blockTopLayer, ItemBlockToxicEverglades.class, "blockDarkWorldGround");
+ GameRegistry.registerBlock(blockSecondLayer, ItemBlockToxicEverglades.class, "blockDarkWorldGround2");
+ GameRegistry.registerBlock(blockPortalFrame, ItemBlockToxicEverglades.class, "blockDarkWorldPortalFrame");
+
+ // Make Flammable
+ Blocks.fire.setFireInfo(blockTopLayer, 30, 20);
+
+ return true;
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/dimension/Dimension_Everglades.java b/src/main/java/gtPlusPlus/everglades/dimension/Dimension_Everglades.java
index 33b36a9ae0..cf53f0f061 100644
--- a/src/main/java/gtPlusPlus/everglades/dimension/Dimension_Everglades.java
+++ b/src/main/java/gtPlusPlus/everglades/dimension/Dimension_Everglades.java
@@ -1,30 +1,28 @@
package gtPlusPlus.everglades.dimension;
-import net.minecraft.block.Block;
-import net.minecraft.init.Blocks;
-
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.everglades.block.BlockEvergladesPortal;
import gtPlusPlus.everglades.item.ItemEvergladesPortalTrigger;
import gtPlusPlus.everglades.world.WorldProviderMod;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
import net.minecraftforge.common.DimensionManager;
public class Dimension_Everglades {
- public Object instance;
- public static int DIMID = CORE.EVERGLADES_ID;
- public static BlockEvergladesPortal portalBlock;
- public static ItemEvergladesPortalTrigger portalItem;
- public static Block blockTopLayer;
- public static Block blockSecondLayer;
- public static Block blockMainFiller = Blocks.stone;
- public static Block blockSecondaryFiller;
- public static Block blockFluidLakes;
- public static Block blockPortalFrame;
-
- public void load() {
- DimensionManager.registerProviderType(DIMID, WorldProviderMod.class, false);
- DimensionManager.registerDimension(DIMID, DIMID);
- }
+ public Object instance;
+ public static int DIMID = CORE.EVERGLADES_ID;
+ public static BlockEvergladesPortal portalBlock;
+ public static ItemEvergladesPortalTrigger portalItem;
+ public static Block blockTopLayer;
+ public static Block blockSecondLayer;
+ public static Block blockMainFiller = Blocks.stone;
+ public static Block blockSecondaryFiller;
+ public static Block blockFluidLakes;
+ public static Block blockPortalFrame;
+ public void load() {
+ DimensionManager.registerProviderType(DIMID, WorldProviderMod.class, false);
+ DimensionManager.registerDimension(DIMID, DIMID);
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/gen/WorldGenDeadLilly.java b/src/main/java/gtPlusPlus/everglades/gen/WorldGenDeadLilly.java
index 0314f71eec..ded79aec6a 100644
--- a/src/main/java/gtPlusPlus/everglades/gen/WorldGenDeadLilly.java
+++ b/src/main/java/gtPlusPlus/everglades/gen/WorldGenDeadLilly.java
@@ -1,7 +1,6 @@
package gtPlusPlus.everglades.gen;
import java.util.Random;
-
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenWaterlily;
@@ -9,20 +8,17 @@ import net.minecraft.world.gen.feature.WorldGenWaterlily;
public class WorldGenDeadLilly extends WorldGenWaterlily {
@Override
- public boolean generate(World world, Random rand, int x, int y, int z)
- {
- for (int l = 0; l < 10; ++l)
- {
+ public boolean generate(World world, Random rand, int x, int y, int z) {
+ for (int l = 0; l < 10; ++l) {
int i1 = x + rand.nextInt(8) - rand.nextInt(8);
int j1 = y + rand.nextInt(4) - rand.nextInt(4);
int k1 = z + rand.nextInt(8) - rand.nextInt(8);
- if (world.isAirBlock(i1, j1, k1) && Blocks.waterlily.canPlaceBlockAt(world, i1, j1, k1))
- {
+ if (world.isAirBlock(i1, j1, k1) && Blocks.waterlily.canPlaceBlockAt(world, i1, j1, k1)) {
world.setBlock(i1, j1, k1, Blocks.waterlily, 0, 2);
}
}
return true;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gtPlusPlus/everglades/gen/WorldGenMinable_Custom.java b/src/main/java/gtPlusPlus/everglades/gen/WorldGenMinable_Custom.java
index 303f7353f0..1480c8651a 100644
--- a/src/main/java/gtPlusPlus/everglades/gen/WorldGenMinable_Custom.java
+++ b/src/main/java/gtPlusPlus/everglades/gen/WorldGenMinable_Custom.java
@@ -2,89 +2,86 @@ package gtPlusPlus.everglades.gen;
import static gtPlusPlus.core.lib.CORE.PI;
+import gtPlusPlus.api.objects.Logger;
import java.util.Random;
-
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenMinable;
-import gtPlusPlus.api.objects.Logger;
-
-public class WorldGenMinable_Custom extends WorldGenMinable
-{
- /** The block to generate. */
- private Block oreToGenerate;
- /** The number of blocks to generate. */
- private int numberOfBlocks;
- /** The block to replace. */
- private Block blockToReplace;
- /** The meta of the block. */
- private int mineableBlockMeta;
+public class WorldGenMinable_Custom extends WorldGenMinable {
+ /** The block to generate. */
+ private Block oreToGenerate;
+ /** The number of blocks to generate. */
+ private int numberOfBlocks;
+ /** The block to replace. */
+ private Block blockToReplace;
+ /** The meta of the block. */
+ private int mineableBlockMeta;
- public WorldGenMinable_Custom(final Block block, final int count){
- super(block, count, Blocks.stone);
- }
+ public WorldGenMinable_Custom(final Block block, final int count) {
+ super(block, count, Blocks.stone);
+ }
- public WorldGenMinable_Custom(final Block block, final int count, final Block target){
- super(block, count, target);
- this.oreToGenerate = block;
- this.numberOfBlocks = count;
- this.blockToReplace = target;
- }
+ public WorldGenMinable_Custom(final Block block, final int count, final Block target) {
+ super(block, count, target);
+ this.oreToGenerate = block;
+ this.numberOfBlocks = count;
+ this.blockToReplace = target;
+ }
- public WorldGenMinable_Custom(final Block block, final int meta, final int number, final Block target){
- this(block, number, target);
- this.mineableBlockMeta = meta;
- }
+ public WorldGenMinable_Custom(final Block block, final int meta, final int number, final Block target) {
+ this(block, number, target);
+ this.mineableBlockMeta = meta;
+ }
- @Override
- public boolean generate(final World world, final Random rand, final int x, final int y, final int z)
- {
- final float f = rand.nextFloat() * PI;
- final double d0 = x + 16 + ((MathHelper.sin(f) * this.numberOfBlocks) / 4.0F);
- final double d1 = (x + 16) - ((MathHelper.sin(f) * this.numberOfBlocks) / 4.0F);
- final double d2 = z + 16 + ((MathHelper.cos(f) * this.numberOfBlocks) / 4.0F);
- final double d3 = (z + 16) - ((MathHelper.cos(f) * this.numberOfBlocks) / 4.0F);
- final double d4 = (y + rand.nextInt(8)) - 1;
- final double d5 = (y + rand.nextInt(8)) - 1;
+ @Override
+ public boolean generate(final World world, final Random rand, final int x, final int y, final int z) {
+ final float f = rand.nextFloat() * PI;
+ final double d0 = x + 16 + ((MathHelper.sin(f) * this.numberOfBlocks) / 4.0F);
+ final double d1 = (x + 16) - ((MathHelper.sin(f) * this.numberOfBlocks) / 4.0F);
+ final double d2 = z + 16 + ((MathHelper.cos(f) * this.numberOfBlocks) / 4.0F);
+ final double d3 = (z + 16) - ((MathHelper.cos(f) * this.numberOfBlocks) / 4.0F);
+ final double d4 = (y + rand.nextInt(8)) - 1;
+ final double d5 = (y + rand.nextInt(8)) - 1;
- for (int l = 0; l <= this.numberOfBlocks; ++l)
- {
- final double d6 = d0 + (((d1 - d0) * l) / this.numberOfBlocks);
- final double d7 = d4 + (((d5 - d4) * l) / this.numberOfBlocks);
- final double d8 = d2 + (((d3 - d2) * l) / this.numberOfBlocks);
- final double d9 = (rand.nextDouble() * this.numberOfBlocks) / 8.0D;
- final double d10 = ((MathHelper.sin((l * PI) / this.numberOfBlocks) + 1.0F) * d9) + 1.0D;
- final double d11 = ((MathHelper.sin((l * PI) / this.numberOfBlocks) + 1.0F) * d9) + 1.0D;
- final int i1 = MathHelper.floor_double(d6 - (d10 / 2.0D));
- final int j1 = MathHelper.floor_double(d7 - (d11 / 2.0D));
- final int k1 = MathHelper.floor_double(d8 - (d10 / 2.0D));
- final int l1 = MathHelper.floor_double(d6 + (d10 / 2.0D));
- final int i2 = MathHelper.floor_double(d7 + (d11 / 2.0D));
- final int j2 = MathHelper.floor_double(d8 + (d10 / 2.0D));
+ for (int l = 0; l <= this.numberOfBlocks; ++l) {
+ final double d6 = d0 + (((d1 - d0) * l) / this.numberOfBlocks);
+ final double d7 = d4 + (((d5 - d4) * l) / this.numberOfBlocks);
+ final double d8 = d2 + (((d3 - d2) * l) / this.numberOfBlocks);
+ final double d9 = (rand.nextDouble() * this.numberOfBlocks) / 8.0D;
+ final double d10 = ((MathHelper.sin((l * PI) / this.numberOfBlocks) + 1.0F) * d9) + 1.0D;
+ final double d11 = ((MathHelper.sin((l * PI) / this.numberOfBlocks) + 1.0F) * d9) + 1.0D;
+ final int i1 = MathHelper.floor_double(d6 - (d10 / 2.0D));
+ final int j1 = MathHelper.floor_double(d7 - (d11 / 2.0D));
+ final int k1 = MathHelper.floor_double(d8 - (d10 / 2.0D));
+ final int l1 = MathHelper.floor_double(d6 + (d10 / 2.0D));
+ final int i2 = MathHelper.floor_double(d7 + (d11 / 2.0D));
+ final int j2 = MathHelper.floor_double(d8 + (d10 / 2.0D));
- for (int k2 = i1; k2 <= l1; ++k2){
- final double d12 = ((k2 + 0.5D) - d6) / (d10 / 2.0D);
- if ((d12 * d12) < 1.0D){
- for (int l2 = j1; l2 <= i2; ++l2){
- final double d13 = ((l2 + 0.5D) - d7) / (d11 / 2.0D);
- if (((d12 * d12) + (d13 * d13)) < 1.0D){
- for (int i3 = k1; i3 <= j2; ++i3){
- final double d14 = ((i3 + 0.5D) - d8) / (d10 / 2.0D);
- if ((((d12 * d12) + (d13 * d13) + (d14 * d14)) < 1.0D) && world.getBlock(k2, l2, i3).isReplaceableOreGen(world, k2, l2, i3, this.blockToReplace))
- {
- world.setBlock(k2, l2, i3, this.oreToGenerate, this.mineableBlockMeta, 3);
- Logger.INFO("Generated a "+this.oreToGenerate.getLocalizedName()+" at x: "+k2+" | y: "+l2+" | z: "+i3);
- }
- }
- }
- }
- }
- }
- }
+ for (int k2 = i1; k2 <= l1; ++k2) {
+ final double d12 = ((k2 + 0.5D) - d6) / (d10 / 2.0D);
+ if ((d12 * d12) < 1.0D) {
+ for (int l2 = j1; l2 <= i2; ++l2) {
+ final double d13 = ((l2 + 0.5D) - d7) / (d11 / 2.0D);
+ if (((d12 * d12) + (d13 * d13)) < 1.0D) {
+ for (int i3 = k1; i3 <= j2; ++i3) {
+ final double d14 = ((i3 + 0.5D) - d8) / (d10 / 2.0D);
+ if ((((d12 * d12) + (d13 * d13) + (d14 * d14)) < 1.0D)
+ && world.getBlock(k2, l2, i3)
+ .isReplaceableOreGen(world, k2, l2, i3, this.blockToReplace)) {
+ world.setBlock(k2, l2, i3, this.oreToGenerate, this.mineableBlockMeta, 3);
+ Logger.INFO("Generated a " + this.oreToGenerate.getLocalizedName() + " at x: " + k2
+ + " | y: " + l2 + " | z: " + i3);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
- return true;
- }
-} \ No newline at end of file
+ return true;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT.java b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT.java
index 2035cfe096..ae60ca1b4e 100644
--- a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT.java
+++ b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT.java
@@ -1,49 +1,60 @@
package gtPlusPlus.everglades.gen.gt;
+import gtPlusPlus.xmod.gregtech.HANDLER_GT;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
-
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
-import gtPlusPlus.xmod.gregtech.HANDLER_GT;
-
public abstract class WorldGen_GT {
- public final String mWorldGenName;
- public final boolean mEnabled;
- private final Map<String, Boolean> mDimensionMap = new ConcurrentHashMap<String, Boolean>();
-
- public WorldGen_GT(String aName, List aList, boolean aDefault) {
- this.mWorldGenName = aName;
- this.mEnabled = HANDLER_GT.sCustomWorldgenFile.get("worldgen", this.mWorldGenName, aDefault);
- if (this.mEnabled) {
- aList.add(this);
- }
-
- }
-
- public boolean executeWorldgen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX,
- int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
- return false;
- }
-
- public boolean executeCavegen(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX,
- int aChunkZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
- return false;
- }
-
- public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) {
- String aDimName = aWorld.provider.getDimensionName();
- Boolean tAllowed = (Boolean) this.mDimensionMap.get(aDimName);
- if (tAllowed == null) {
- boolean tValue = HANDLER_GT.sCustomWorldgenFile.get("worldgen.dimensions." + this.mWorldGenName, aDimName,
- aDimensionType == aAllowedDimensionType);
- this.mDimensionMap.put(aDimName, Boolean.valueOf(tValue));
- return tValue;
- } else {
- return tAllowed.booleanValue();
- }
- }
-} \ No newline at end of file
+ public final String mWorldGenName;
+ public final boolean mEnabled;
+ private final Map<String, Boolean> mDimensionMap = new ConcurrentHashMap<String, Boolean>();
+
+ public WorldGen_GT(String aName, List aList, boolean aDefault) {
+ this.mWorldGenName = aName;
+ this.mEnabled = HANDLER_GT.sCustomWorldgenFile.get("worldgen", this.mWorldGenName, aDefault);
+ if (this.mEnabled) {
+ aList.add(this);
+ }
+ }
+
+ public boolean executeWorldgen(
+ World aWorld,
+ Random aRandom,
+ String aBiome,
+ int aDimensionType,
+ int aChunkX,
+ int aChunkZ,
+ IChunkProvider aChunkGenerator,
+ IChunkProvider aChunkProvider) {
+ return false;
+ }
+
+ public boolean executeCavegen(
+ World aWorld,
+ Random aRandom,
+ String aBiome,
+ int aDimensionType,
+ int aChunkX,
+ int aChunkZ,
+ IChunkProvider aChunkGenerator,
+ IChunkProvider aChunkProvider) {
+ return false;
+ }
+
+ public boolean isGenerationAllowed(World aWorld, int aDimensionType, int aAllowedDimensionType) {
+ String aDimName = aWorld.provider.getDimensionName();
+ Boolean tAllowed = (Boolean) this.mDimensionMap.get(aDimName);
+ if (tAllowed == null) {
+ boolean tValue = HANDLER_GT.sCustomWorldgenFile.get(
+ "worldgen.dimensions." + this.mWorldGenName, aDimName, aDimensionType == aAllowedDimensionType);
+ this.mDimensionMap.put(aDimName, Boolean.valueOf(tValue));
+ return tValue;
+ } else {
+ return tAllowed.booleanValue();
+ }
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java
index f1d62cf58e..cbf07372fc 100644
--- a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java
+++ b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Base.java
@@ -1,471 +1,538 @@
package gtPlusPlus.everglades.gen.gt;
-import java.util.*;
-
import cpw.mods.fml.common.IWorldGenerator;
-
-import net.minecraft.block.Block;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.Chunk;
-import net.minecraft.world.chunk.IChunkProvider;
-import net.minecraft.world.gen.feature.WorldGenMinable;
-
import gregtech.api.util.GT_Log;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.random.XSTR;
import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.everglades.dimension.Dimension_Everglades;
import gtPlusPlus.xmod.gregtech.HANDLER_GT;
+import java.util.*;
+import net.minecraft.block.Block;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.Chunk;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.feature.WorldGenMinable;
public class WorldGen_GT_Base implements IWorldGenerator {
- /**
- * Class Variables
- */
-
- /**
- * Control percentage of filled 3x3 chunks. Lower number means less oreveins
- * spawn
- */
- public static int oreveinPercentage;
- /**
- * Control number of attempts to find a valid orevein. Generally this
- * maximum limit isn't hit, selecting a vein is cheap
- */
- public static int oreveinAttempts;
- /**
- * Control number of attempts to place a valid orevein. If a vein wasn't
- * placed due to height restrictions, completely in the water, etc, another
- * attempt is tried.
- */
- public static int oreveinMaxPlacementAttempts;
- /**
- * Debug parameter for world generation. Tracks chunks added/removed from
- * run queue.
- */
- public static boolean debugWorldGen = false;
- /**
- * Try re-implement Richard Hendrick's Chunk by Chunk Ore Generation from
- * his GT5u fork.
- */
-
- public static List<Runnable> mList = new ArrayList<Runnable>();
- public static HashSet<Long> ProcChunks = new HashSet<Long>();
- // This is probably not going to work. Trying to create a fake orevein to
- // put into hashtable when there will be no ores in a vein.
- public static WorldGen_GT_Ore_Layer noOresInVein = new WorldGen_GT_Ore_Layer("vein0", 0, 255, 0, 0,
- 0, ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON);
-
- public static Hashtable<Long, WorldGen_GT_Ore_Layer> validOreveins = new Hashtable<Long, WorldGen_GT_Ore_Layer>(
- 1024);
-
- public boolean mIsGenerating = false;
- public static final Object listLock = new Object();
- // private static boolean gcAsteroids = true;
-
- public WorldGen_GT_Base() {
- if (debugWorldGen) {
- GT_Log.out.println("GTPP_Worldgenerator created");
- }
- }
-
- @Override
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator,
- IChunkProvider chunkProvider) {
- if (world.provider.dimensionId == Dimension_Everglades.DIMID) {
- generateSafely(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
- }
- }
-
- public synchronized void generateSafely(Random random, int chunkX, int chunkZ, World world,
- IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
- int xDim = Dimension_Everglades.DIMID;
- switch (world.provider.dimensionId) {
- case -1: // Nether
- // generateNether(world, random, chunkX * 16, chunkZ * 16);
- break;
- case 0: // Overworld
- // generateSurface(world, random, chunkX * 16, chunkZ * 16);
- break;
- case 1: // End
- // generateEnd(world, random, chunkX * 16, chunkZ * 16);
- break;
- default: // Any other dimension
- if (world.provider.dimensionId != xDim) {
- break;
- }
- else {
- generateEverglades(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
- break;
- }
- }
- }
-
- private synchronized void generateEverglades(Random aRandom, int aX, int aZ, World aWorld,
- IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
- Logger.WORLD("Trying to Generate Dimension.");
- synchronized (listLock) {
- Logger.WORLD("Locked List addition.");
- if (WorldGen_GT_Base.mList.add(new WorldGenContainer(new XSTR(Math.abs(aRandom.nextInt()) + 1), aX, aZ,
- Dimension_Everglades.DIMID,
- aWorld, aChunkGenerator, aChunkProvider,
- aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName))){
- Logger.WORLD("Locked List addition. Success.");
- }
- else {
- Logger.WORLD("Locked List addition. Fail.");
- }
- if (debugWorldGen)
- GT_Log.out.println("ADD WorldSeed:" + aWorld.getSeed() + " DimId" + aWorld.provider.dimensionId
- + " chunk x:" + aX + " z:" + aZ + " SIZE: " + WorldGen_GT_Base.mList.size());
- }
-
- if (!this.mIsGenerating) {
- Logger.WORLD("Is not generating.");
- this.mIsGenerating = true;
- Logger.WORLD("Setting Generation to true.");
- int mList_sS = WorldGen_GT_Base.mList.size();
- mList_sS = Math.min(mList_sS, 3); // Run a maximum of 3 chunks at a
- // time through worldgen. Extra
- // chunks get done later.
- for (int i = 0; i < mList_sS; i++) {
- WorldGenContainer toRun = (WorldGenContainer) WorldGen_GT_Base.mList.get(0);
- if (debugWorldGen)
- GT_Log.out.println("RUN WorldSeed:" + aWorld.getSeed() + " DimId" + aWorld.provider.dimensionId
- + " chunk x:" + toRun.mX + " z:" + toRun.mZ + " SIZE: " + WorldGen_GT_Base.mList.size()
- + " i: " + i);
- synchronized (listLock) {
- Logger.WORLD("Locked List Removal.");
- WorldGen_GT_Base.mList.remove(0);
- }
- toRun.run();
- }
- this.mIsGenerating = false;
- Logger.WORLD("Is Generating now set to false..");
- }
- }
-
- public void generateOre(Block block, World world, Random random, int chunk_x, int chunk_z, int maxX, int maxZ,
- int maxVeinSize, int chancesToSpawn, int minY, int maxY, Block generateIn) {
- int heightRange = maxY - minY;
- WorldGenMinable worldgenminable = new WorldGenMinable(block, maxVeinSize, generateIn);
- for (int k1 = 0; k1 < chancesToSpawn; ++k1) {
- int xrand = random.nextInt(16);
- int yrand = random.nextInt(heightRange) + minY;
- int zrand = random.nextInt(16);
- worldgenminable.generate(world, random, chunk_x + xrand, yrand, chunk_z + zrand);
- }
- }
-
- public static class WorldGenContainer implements Runnable {
- public final Random mRandom;
- public final int mX;
- public final int mZ;
- public final int mDimensionType;
- public final World mWorld;
- public final IChunkProvider mChunkGenerator;
- public final IChunkProvider mChunkProvider;
- public final String mBiome;
-
- // Local class to track which orevein seeds must be checked when doing
- // chunkified worldgen
- class NearbySeeds {
- public int mX;
- public int mZ;
-
- NearbySeeds(int x, int z) {
- this.mX = x;
- this.mZ = z;
- }
- };
-
- public static ArrayList<NearbySeeds> seedList = new ArrayList<NearbySeeds>();
-
- // aX and aZ are now the by-chunk X and Z for the chunk of interest
- public WorldGenContainer(Random aRandom, int aX, int aZ, int aDimensionType, World aWorld,
- IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider, String aBiome) {
- this.mRandom = aRandom;
- this.mX = aX;
- this.mZ = aZ;
- this.mDimensionType = aDimensionType;
- this.mWorld = aWorld;
- this.mChunkGenerator = aChunkGenerator;
- this.mChunkProvider = aChunkProvider;
- this.mBiome = aBiome;
- }
-
- public void worldGenFindVein(int oreseedX, int oreseedZ) {
- // Explanation of oreveinseed implementation.
- // (long)this.mWorld.getSeed()<<16) Deep Dark does two oregen
- // passes, one with getSeed set to +1 the original world seed. This
- // pushes that +1 off the low bits of oreseedZ, so that the hashes
- // are far apart for the two passes.
- // ((this.mWorld.provider.dimensionId & 0xffL)<<56) Puts the
- // dimension in the top bits of the hash, to make sure to get unique
- // hashes per dimension
- // ((long)oreseedX & 0x000000000fffffffL) << 28) Puts the chunk X in
- // the bits 29-55. Cuts off the top few bits of the chunk so we have
- // bits for dimension.
- // ( (long)oreseedZ & 0x000000000fffffffL )) Puts the chunk Z in the
- // bits 0-27. Cuts off the top few bits of the chunk so we have bits
- // for dimension.
- long oreveinSeed = (this.mWorld.getSeed() << 16) ^ ((this.mWorld.provider.dimensionId & 0xffL) << 56
- | ((oreseedX & 0x000000000fffffffL) << 28) | (oreseedZ & 0x000000000fffffffL)); // Use
- // an
- // RNG
- // that
- // is
- // identical
- // every
- // time
- // it
- // is
- // called
- // for
- // this
- // oreseed.
- XSTR oreveinRNG = new XSTR(oreveinSeed);
- int oreveinPercentageRoll = oreveinRNG.nextInt(100); // Roll the
- // dice, see
- // if we get
- // an
- // orevein
- // here at
- // all
- int noOrePlacedCount = 0;
- String tDimensionName = "";
- if (debugWorldGen) {
- tDimensionName = this.mWorld.provider.getDimensionName();
- }
-
- if (debugWorldGen){
- GT_Log.out.println(" Finding oreveins for oreveinSeed=" + oreveinSeed + " mX=" + this.mX + " mZ="
- + this.mZ + " oreseedX=" + oreseedX + " oreseedZ=" + oreseedZ + " worldSeed="
- + this.mWorld.getSeed());
- }
-
- Logger.INFO("[World Generation Debug] !validOreveins.containsKey(oreveinSeed) | oreveinSeed: "+oreveinSeed);
- // Search for a valid orevein for this dimension
- if (!validOreveins.containsKey(oreveinSeed)) {
-
-
- Logger.INFO("[World Generation Debug] oreveinPercentageRoll < oreveinPercentage? "+((oreveinPercentageRoll < oreveinPercentage)));
- Logger.INFO("[World Generation Debug] WorldGen_GT_Ore_Layer.sWeight > 0? "+(WorldGen_GT_Ore_Layer.sWeight > 0));
- Logger.INFO("[World Generation Debug] WorldGen_GT_Ore_Layer.sList.size() > 0? "+(WorldGen_GT_Ore_Layer.sList.size() > 0));
- if ((oreveinPercentageRoll < oreveinPercentage) && (WorldGen_GT_Ore_Layer.sWeight > 0)
- && (WorldGen_GT_Ore_Layer.sList.size() > 0)) {
- int placementAttempts = 0;
- boolean oreveinFound = false;
- int i;
- for (i = 0; (i < oreveinAttempts) && (!oreveinFound)
- && (placementAttempts < oreveinMaxPlacementAttempts); i++) {
- Logger.INFO("[World Generation Debug] i: "+i);
- Logger.INFO("[World Generation Debug] placementAttempts: "+placementAttempts);
- Logger.INFO("[World Generation Debug] oreveinAttempts: "+oreveinAttempts);
- Logger.INFO("[World Generation Debug] (placementAttempts < oreveinMaxPlacementAttempts): "+(placementAttempts < oreveinMaxPlacementAttempts));
- Logger.INFO("[World Generation Debug] oreveinFound: "+oreveinFound);
- int tRandomWeight = oreveinRNG.nextInt(WorldGen_GT_Ore_Layer.sWeight);
- for (WorldGen_GT_Ore_Layer tWorldGen : WorldGen_GT_Ore_Layer.sList) {
- Logger.INFO("[World Generation Debug] Iterating sList - Size: "+WorldGen_GT_Ore_Layer.sList.size());
- tRandomWeight -= (tWorldGen).mWeight;
- if (tRandomWeight <= 0) {
- try {
- // Adjust the seed so that this layer has a
- // series of unique random numbers.
- // Otherwise multiple attempts at this same
- // oreseed will get the same offset and X/Z
- // values. If an orevein failed, any orevein
- // with the
- // same minimum heights would fail as well.
- // This prevents that, giving each orevein a
- // unique height each pass through here.
- int placementResult = tWorldGen.executeWorldgenChunkified(this.mWorld,
- new XSTR(oreveinSeed ^ (Block.getIdFromBlock(tWorldGen.mPrimaryMeta))), this.mBiome,
- this.mDimensionType, this.mX * 16, this.mZ * 16, oreseedX * 16,
- oreseedZ * 16, this.mChunkGenerator, this.mChunkProvider);
- switch (placementResult) {
- case WorldGen_GT_Ore_Layer.ORE_PLACED:
- if (debugWorldGen)
- GT_Log.out.println(" Added oreveinSeed=" + oreveinSeed
- + " tries at oremix=" + i + " placementAttempts="
- + placementAttempts + " dimensionName=" + tDimensionName);
- validOreveins.put(oreveinSeed, tWorldGen);
- oreveinFound = true;
- Logger.INFO("[World Generation Debug] ORE_PLACED");
- break;
- case WorldGen_GT_Ore_Layer.NO_ORE_IN_BOTTOM_LAYER:
- placementAttempts++;
- Logger.INFO("[World Generation Debug] NO_ORE_IN_BOTTOM_LAYER | Attempts: "+placementAttempts);
- // SHould do retry in this case
- // until out of chances
- break;
- case WorldGen_GT_Ore_Layer.NO_OVERLAP:
- // Orevein didn't reach this chunk,
- // can't add it yet to the hash
- Logger.INFO("[World Generation Debug] NO_OVERLAP");
- if (debugWorldGen) GT_Log.out.println(
- " Added far oreveinSeed=" + oreveinSeed + " " +
- ( tWorldGen).mWorldGenName +
- " tries at oremix=" + i +
- " placementAttempts=" + placementAttempts +
- " dimensionName=" + tDimensionName
- );
- validOreveins.put(oreveinSeed, tWorldGen);
- oreveinFound = true;
- break;
- case WorldGen_GT_Ore_Layer.NO_OVERLAP_AIR_BLOCK:
- if (debugWorldGen) GT_Log.out.println(
- " No overlap and air block in test spot=" + oreveinSeed + " " +
- ( tWorldGen).mWorldGenName +
- " tries at oremix=" + i +
- " placementAttempts=" + placementAttempts +
- " dimensionName=" + tDimensionName
- );
- // SHould do retry in this case until out of chances
- Logger.INFO("[World Generation Debug] NO_OVERLAP_AIR_BLOCK");
- placementAttempts++;
- break;
- }
- break; // Try the next orevein
- }
- catch (Throwable e) {
- if (debugWorldGen)
- GT_Log.out.println("Exception occurred on oreVein" + tWorldGen + " oreveinSeed="
- + oreveinSeed + " mX=" + this.mX + " mZ=" + this.mZ + " oreseedX="
- + oreseedX + " oreseedZ=" + oreseedZ);
- e.printStackTrace(GT_Log.err);
- }
- }
- }
- }
- // Only add an empty orevein if are unable to place a vein
- // at the oreseed chunk.
- if ((!oreveinFound) && (this.mX == oreseedX) && (this.mZ == oreseedZ)) {
- if (debugWorldGen)
- GT_Log.out.println(" Empty oreveinSeed=" + oreveinSeed + " mX=" + this.mX + " mZ=" + this.mZ
- + " oreseedX=" + oreseedX + " oreseedZ=" + oreseedZ + " tries at oremix=" + i
- + " placementAttempts=" + placementAttempts + " dimensionName=" + tDimensionName);
- validOreveins.put(oreveinSeed, noOresInVein);
- }
- }
- else if (oreveinPercentageRoll >= oreveinPercentage) {
- if (debugWorldGen)
- GT_Log.out.println(" Skipped oreveinSeed=" + oreveinSeed + " mX=" + this.mX + " mZ=" + this.mZ
- + " oreseedX=" + oreseedX + " oreseedZ=" + oreseedZ + " RNG=" + oreveinPercentageRoll
- + " %=" + oreveinPercentage + " dimensionName=" + tDimensionName);
- validOreveins.put(oreveinSeed, noOresInVein);
- }
- }
- else {
- // oreseed is located in the previously processed table
- if (debugWorldGen)
- GT_Log.out.print(" Valid oreveinSeed=" + oreveinSeed + " validOreveins.size()="
- + validOreveins.size() + " ");
- WorldGen_GT_Ore_Layer tWorldGen = validOreveins.get(oreveinSeed);
- oreveinRNG.setSeed(oreveinSeed ^ (Block.getIdFromBlock(tWorldGen.mPrimaryMeta))); // Reset
- // RNG
- // to
- // only
- // be
- // based
- // on
- // oreseed
- // X/Z
- // and
- // type
- // of
- // vein
- int placementResult = tWorldGen.executeWorldgenChunkified(this.mWorld, oreveinRNG, this.mBiome,
- this.mDimensionType, this.mX * 16, this.mZ * 16, oreseedX * 16, oreseedZ * 16,
- this.mChunkGenerator, this.mChunkProvider);
- switch (placementResult) {
- case WorldGen_GT_Ore_Layer.NO_ORE_IN_BOTTOM_LAYER:
- if (debugWorldGen)
- GT_Log.out.println(" No ore in bottom layer");
- break;
- case WorldGen_GT_Ore_Layer.NO_OVERLAP:
- if (debugWorldGen)
- GT_Log.out.println(" No overlap");
- break;
- }
- }
- }
-
- @Override
- public void run() {
- long startTime = System.nanoTime();
- int oreveinMaxSize;
-
- // Determine bounding box on how far out to check for oreveins
- // affecting this chunk
- // For now, manually reducing oreveinMaxSize when not in the
- // Underdark for performance
- if (this.mWorld.provider.getDimensionName().equals("Underdark")) {
- oreveinMaxSize = 24; // Leave Deep Dark/Underdark max oregen at
- // 32, instead of 64
- }
- else {
- oreveinMaxSize = 48;
- }
-
- int wXbox = this.mX - (oreveinMaxSize / 16);
- int eXbox = this.mX + (oreveinMaxSize / 16 + 1); // Need to add 1
- // since it is
- // compared
- // using a <
- int nZbox = this.mZ - (oreveinMaxSize / 16);
- int sZbox = this.mZ + (oreveinMaxSize / 16 + 1);
-
- // Search for orevein seeds and add to the list;
- for (int x = wXbox; x < eXbox; x++) {
- for (int z = nZbox; z < sZbox; z++) {
- // Determine if this X/Z is an orevein seed
- if (((Math.abs(x) % 3) == 1) && ((Math.abs(z) % 3) == 1)) {
- if (debugWorldGen)
- GT_Log.out.println("Adding seed x=" + x + " z=" + z);
- seedList.add(new NearbySeeds(x, z));
- }
- }
- }
-
- // Now process each oreseed vs this requested chunk
- for (; seedList.size() != 0; seedList.remove(0)) {
- if (debugWorldGen)
- GT_Log.out.println("Processing seed x=" + seedList.get(0).mX + " z=" + seedList.get(0).mZ);
- worldGenFindVein(seedList.get(0).mX, seedList.get(0).mZ);
- }
-
- long oregenTime = System.nanoTime();
-
- // Do leftover worldgen for this chunk (GT_Stones and GT_small_ores)
- try {
- for (WorldGen_GT tWorldGen : HANDLER_GT.sWorldgenListEverglades) {
- /*
- * if (debugWorldGen) GT_Log.out.println(
- * "tWorldGen.mWorldGenName="+tWorldGen.mWorldGenName );
- */
- tWorldGen.executeWorldgen(this.mWorld, this.mRandom, this.mBiome, this.mDimensionType, this.mX * 16,
- this.mZ * 16, this.mChunkGenerator, this.mChunkProvider);
- }
- }
- catch (Throwable e) {
- e.printStackTrace(GT_Log.err);
- }
-
- long leftOverTime = System.nanoTime();
-
- Chunk tChunk = this.mWorld.getChunkFromBlockCoords(this.mX, this.mZ);
- if (tChunk != null) {
- tChunk.isModified = true;
- }
- long endTime = System.nanoTime();
- long duration = (endTime - startTime);
- if (debugWorldGen) {
- GT_Log.out.println(" Oregen took " + (oregenTime - startTime) + " Leftover gen took "
- + (leftOverTime - oregenTime) + " Worldgen took " + duration + " nanoseconds");
- }
- }
- }
-
+ /**
+ * Class Variables
+ */
+
+ /**
+ * Control percentage of filled 3x3 chunks. Lower number means less oreveins
+ * spawn
+ */
+ public static int oreveinPercentage;
+ /**
+ * Control number of attempts to find a valid orevein. Generally this
+ * maximum limit isn't hit, selecting a vein is cheap
+ */
+ public static int oreveinAttempts;
+ /**
+ * Control number of attempts to place a valid orevein. If a vein wasn't
+ * placed due to height restrictions, completely in the water, etc, another
+ * attempt is tried.
+ */
+ public static int oreveinMaxPlacementAttempts;
+ /**
+ * Debug parameter for world generation. Tracks chunks added/removed from
+ * run queue.
+ */
+ public static boolean debugWorldGen = false;
+ /**
+ * Try re-implement Richard Hendrick's Chunk by Chunk Ore Generation from
+ * his GT5u fork.
+ */
+ public static List<Runnable> mList = new ArrayList<Runnable>();
+
+ public static HashSet<Long> ProcChunks = new HashSet<Long>();
+ // This is probably not going to work. Trying to create a fake orevein to
+ // put into hashtable when there will be no ores in a vein.
+ public static WorldGen_GT_Ore_Layer noOresInVein = new WorldGen_GT_Ore_Layer(
+ "vein0",
+ 0,
+ 255,
+ 0,
+ 0,
+ 0,
+ ELEMENT.getInstance().IRON,
+ ELEMENT.getInstance().IRON,
+ ELEMENT.getInstance().IRON,
+ ELEMENT.getInstance().IRON);
+
+ public static Hashtable<Long, WorldGen_GT_Ore_Layer> validOreveins =
+ new Hashtable<Long, WorldGen_GT_Ore_Layer>(1024);
+
+ public boolean mIsGenerating = false;
+ public static final Object listLock = new Object();
+ // private static boolean gcAsteroids = true;
+
+ public WorldGen_GT_Base() {
+ if (debugWorldGen) {
+ GT_Log.out.println("GTPP_Worldgenerator created");
+ }
+ }
+
+ @Override
+ public void generate(
+ Random random,
+ int chunkX,
+ int chunkZ,
+ World world,
+ IChunkProvider chunkGenerator,
+ IChunkProvider chunkProvider) {
+ if (world.provider.dimensionId == Dimension_Everglades.DIMID) {
+ generateSafely(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
+ }
+ }
+
+ public synchronized void generateSafely(
+ Random random,
+ int chunkX,
+ int chunkZ,
+ World world,
+ IChunkProvider chunkGenerator,
+ IChunkProvider chunkProvider) {
+ int xDim = Dimension_Everglades.DIMID;
+ switch (world.provider.dimensionId) {
+ case -1: // Nether
+ // generateNether(world, random, chunkX * 16, chunkZ * 16);
+ break;
+ case 0: // Overworld
+ // generateSurface(world, random, chunkX * 16, chunkZ * 16);
+ break;
+ case 1: // End
+ // generateEnd(world, random, chunkX * 16, chunkZ * 16);
+ break;
+ default: // Any other dimension
+ if (world.provider.dimensionId != xDim) {
+ break;
+ } else {
+ generateEverglades(random, chunkX, chunkZ, world, chunkGenerator, chunkProvider);
+ break;
+ }
+ }
+ }
+
+ private synchronized void generateEverglades(
+ Random aRandom,
+ int aX,
+ int aZ,
+ World aWorld,
+ IChunkProvider aChunkGenerator,
+ IChunkProvider aChunkProvider) {
+ Logger.WORLD("Trying to Generate Dimension.");
+ synchronized (listLock) {
+ Logger.WORLD("Locked List addition.");
+ if (WorldGen_GT_Base.mList.add(new WorldGenContainer(
+ new XSTR(Math.abs(aRandom.nextInt()) + 1),
+ aX,
+ aZ,
+ Dimension_Everglades.DIMID,
+ aWorld,
+ aChunkGenerator,
+ aChunkProvider,
+ aWorld.getBiomeGenForCoords(aX * 16 + 8, aZ * 16 + 8).biomeName))) {
+ Logger.WORLD("Locked List addition. Success.");
+ } else {
+ Logger.WORLD("Locked List addition. Fail.");
+ }
+ if (debugWorldGen)
+ GT_Log.out.println("ADD WorldSeed:" + aWorld.getSeed() + " DimId" + aWorld.provider.dimensionId
+ + " chunk x:" + aX + " z:" + aZ + " SIZE: " + WorldGen_GT_Base.mList.size());
+ }
+
+ if (!this.mIsGenerating) {
+ Logger.WORLD("Is not generating.");
+ this.mIsGenerating = true;
+ Logger.WORLD("Setting Generation to true.");
+ int mList_sS = WorldGen_GT_Base.mList.size();
+ mList_sS = Math.min(mList_sS, 3); // Run a maximum of 3 chunks at a
+ // time through worldgen. Extra
+ // chunks get done later.
+ for (int i = 0; i < mList_sS; i++) {
+ WorldGenContainer toRun = (WorldGenContainer) WorldGen_GT_Base.mList.get(0);
+ if (debugWorldGen)
+ GT_Log.out.println("RUN WorldSeed:" + aWorld.getSeed() + " DimId" + aWorld.provider.dimensionId
+ + " chunk x:" + toRun.mX + " z:" + toRun.mZ + " SIZE: " + WorldGen_GT_Base.mList.size()
+ + " i: " + i);
+ synchronized (listLock) {
+ Logger.WORLD("Locked List Removal.");
+ WorldGen_GT_Base.mList.remove(0);
+ }
+ toRun.run();
+ }
+ this.mIsGenerating = false;
+ Logger.WORLD("Is Generating now set to false..");
+ }
+ }
+
+ public void generateOre(
+ Block block,
+ World world,
+ Random random,
+ int chunk_x,
+ int chunk_z,
+ int maxX,
+ int maxZ,
+ int maxVeinSize,
+ int chancesToSpawn,
+ int minY,
+ int maxY,
+ Block generateIn) {
+ int heightRange = maxY - minY;
+ WorldGenMinable worldgenminable = new WorldGenMinable(block, maxVeinSize, generateIn);
+ for (int k1 = 0; k1 < chancesToSpawn; ++k1) {
+ int xrand = random.nextInt(16);
+ int yrand = random.nextInt(heightRange) + minY;
+ int zrand = random.nextInt(16);
+ worldgenminable.generate(world, random, chunk_x + xrand, yrand, chunk_z + zrand);
+ }
+ }
+
+ public static class WorldGenContainer implements Runnable {
+ public final Random mRandom;
+ public final int mX;
+ public final int mZ;
+ public final int mDimensionType;
+ public final World mWorld;
+ public final IChunkProvider mChunkGenerator;
+ public final IChunkProvider mChunkProvider;
+ public final String mBiome;
+
+ // Local class to track which orevein seeds must be checked when doing
+ // chunkified worldgen
+ class NearbySeeds {
+ public int mX;
+ public int mZ;
+
+ NearbySeeds(int x, int z) {
+ this.mX = x;
+ this.mZ = z;
+ }
+ }
+ ;
+
+ public static ArrayList<NearbySeeds> seedList = new ArrayList<NearbySeeds>();
+
+ // aX and aZ are now the by-chunk X and Z for the chunk of interest
+ public WorldGenContainer(
+ Random aRandom,
+ int aX,
+ int aZ,
+ int aDimensionType,
+ World aWorld,
+ IChunkProvider aChunkGenerator,
+ IChunkProvider aChunkProvider,
+ String aBiome) {
+ this.mRandom = aRandom;
+ this.mX = aX;
+ this.mZ = aZ;
+ this.mDimensionType = aDimensionType;
+ this.mWorld = aWorld;
+ this.mChunkGenerator = aChunkGenerator;
+ this.mChunkProvider = aChunkProvider;
+ this.mBiome = aBiome;
+ }
+
+ public void worldGenFindVein(int oreseedX, int oreseedZ) {
+ // Explanation of oreveinseed implementation.
+ // (long)this.mWorld.getSeed()<<16) Deep Dark does two oregen
+ // passes, one with getSeed set to +1 the original world seed. This
+ // pushes that +1 off the low bits of oreseedZ, so that the hashes
+ // are far apart for the two passes.
+ // ((this.mWorld.provider.dimensionId & 0xffL)<<56) Puts the
+ // dimension in the top bits of the hash, to make sure to get unique
+ // hashes per dimension
+ // ((long)oreseedX & 0x000000000fffffffL) << 28) Puts the chunk X in
+ // the bits 29-55. Cuts off the top few bits of the chunk so we have
+ // bits for dimension.
+ // ( (long)oreseedZ & 0x000000000fffffffL )) Puts the chunk Z in the
+ // bits 0-27. Cuts off the top few bits of the chunk so we have bits
+ // for dimension.
+ long oreveinSeed = (this.mWorld.getSeed() << 16)
+ ^ ((this.mWorld.provider.dimensionId & 0xffL) << 56
+ | ((oreseedX & 0x000000000fffffffL) << 28)
+ | (oreseedZ & 0x000000000fffffffL)); // Use
+ // an
+ // RNG
+ // that
+ // is
+ // identical
+ // every
+ // time
+ // it
+ // is
+ // called
+ // for
+ // this
+ // oreseed.
+ XSTR oreveinRNG = new XSTR(oreveinSeed);
+ int oreveinPercentageRoll = oreveinRNG.nextInt(100); // Roll the
+ // dice, see
+ // if we get
+ // an
+ // orevein
+ // here at
+ // all
+ int noOrePlacedCount = 0;
+ String tDimensionName = "";
+ if (debugWorldGen) {
+ tDimensionName = this.mWorld.provider.getDimensionName();
+ }
+
+ if (debugWorldGen) {
+ GT_Log.out.println(" Finding oreveins for oreveinSeed=" + oreveinSeed + " mX=" + this.mX + " mZ="
+ + this.mZ + " oreseedX=" + oreseedX + " oreseedZ=" + oreseedZ + " worldSeed="
+ + this.mWorld.getSeed());
+ }
+
+ Logger.INFO(
+ "[World Generation Debug] !validOreveins.containsKey(oreveinSeed) | oreveinSeed: " + oreveinSeed);
+ // Search for a valid orevein for this dimension
+ if (!validOreveins.containsKey(oreveinSeed)) {
+
+ Logger.INFO("[World Generation Debug] oreveinPercentageRoll < oreveinPercentage? "
+ + ((oreveinPercentageRoll < oreveinPercentage)));
+ Logger.INFO("[World Generation Debug] WorldGen_GT_Ore_Layer.sWeight > 0? "
+ + (WorldGen_GT_Ore_Layer.sWeight > 0));
+ Logger.INFO("[World Generation Debug] WorldGen_GT_Ore_Layer.sList.size() > 0? "
+ + (WorldGen_GT_Ore_Layer.sList.size() > 0));
+ if ((oreveinPercentageRoll < oreveinPercentage)
+ && (WorldGen_GT_Ore_Layer.sWeight > 0)
+ && (WorldGen_GT_Ore_Layer.sList.size() > 0)) {
+ int placementAttempts = 0;
+ boolean oreveinFound = false;
+ int i;
+ for (i = 0;
+ (i < oreveinAttempts)
+ && (!oreveinFound)
+ && (placementAttempts < oreveinMaxPlacementAttempts);
+ i++) {
+ Logger.INFO("[World Generation Debug] i: " + i);
+ Logger.INFO("[World Generation Debug] placementAttempts: " + placementAttempts);
+ Logger.INFO("[World Generation Debug] oreveinAttempts: " + oreveinAttempts);
+ Logger.INFO("[World Generation Debug] (placementAttempts < oreveinMaxPlacementAttempts): "
+ + (placementAttempts < oreveinMaxPlacementAttempts));
+ Logger.INFO("[World Generation Debug] oreveinFound: " + oreveinFound);
+ int tRandomWeight = oreveinRNG.nextInt(WorldGen_GT_Ore_Layer.sWeight);
+ for (WorldGen_GT_Ore_Layer tWorldGen : WorldGen_GT_Ore_Layer.sList) {
+ Logger.INFO("[World Generation Debug] Iterating sList - Size: "
+ + WorldGen_GT_Ore_Layer.sList.size());
+ tRandomWeight -= (tWorldGen).mWeight;
+ if (tRandomWeight <= 0) {
+ try {
+ // Adjust the seed so that this layer has a
+ // series of unique random numbers.
+ // Otherwise multiple attempts at this same
+ // oreseed will get the same offset and X/Z
+ // values. If an orevein failed, any orevein
+ // with the
+ // same minimum heights would fail as well.
+ // This prevents that, giving each orevein a
+ // unique height each pass through here.
+ int placementResult = tWorldGen.executeWorldgenChunkified(
+ this.mWorld,
+ new XSTR(oreveinSeed ^ (Block.getIdFromBlock(tWorldGen.mPrimaryMeta))),
+ this.mBiome,
+ this.mDimensionType,
+ this.mX * 16,
+ this.mZ * 16,
+ oreseedX * 16,
+ oreseedZ * 16,
+ this.mChunkGenerator,
+ this.mChunkProvider);
+ switch (placementResult) {
+ case WorldGen_GT_Ore_Layer.ORE_PLACED:
+ if (debugWorldGen)
+ GT_Log.out.println(" Added oreveinSeed=" + oreveinSeed
+ + " tries at oremix=" + i + " placementAttempts="
+ + placementAttempts + " dimensionName=" + tDimensionName);
+ validOreveins.put(oreveinSeed, tWorldGen);
+ oreveinFound = true;
+ Logger.INFO("[World Generation Debug] ORE_PLACED");
+ break;
+ case WorldGen_GT_Ore_Layer.NO_ORE_IN_BOTTOM_LAYER:
+ placementAttempts++;
+ Logger.INFO("[World Generation Debug] NO_ORE_IN_BOTTOM_LAYER | Attempts: "
+ + placementAttempts);
+ // SHould do retry in this case
+ // until out of chances
+ break;
+ case WorldGen_GT_Ore_Layer.NO_OVERLAP:
+ // Orevein didn't reach this chunk,
+ // can't add it yet to the hash
+ Logger.INFO("[World Generation Debug] NO_OVERLAP");
+ if (debugWorldGen)
+ GT_Log.out.println(" Added far oreveinSeed=" + oreveinSeed + " "
+ + (tWorldGen).mWorldGenName
+ + " tries at oremix="
+ + i + " placementAttempts="
+ + placementAttempts + " dimensionName="
+ + tDimensionName);
+ validOreveins.put(oreveinSeed, tWorldGen);
+ oreveinFound = true;
+ break;
+ case WorldGen_GT_Ore_Layer.NO_OVERLAP_AIR_BLOCK:
+ if (debugWorldGen)
+ GT_Log.out.println(" No overlap and air block in test spot="
+ + oreveinSeed + " " + (tWorldGen).mWorldGenName
+ + " tries at oremix="
+ + i + " placementAttempts="
+ + placementAttempts + " dimensionName="
+ + tDimensionName);
+ // SHould do retry in this case until out of chances
+ Logger.INFO("[World Generation Debug] NO_OVERLAP_AIR_BLOCK");
+ placementAttempts++;
+ break;
+ }
+ break; // Try the next orevein
+ } catch (Throwable e) {
+ if (debugWorldGen)
+ GT_Log.out.println("Exception occurred on oreVein" + tWorldGen + " oreveinSeed="
+ + oreveinSeed + " mX=" + this.mX + " mZ=" + this.mZ + " oreseedX="
+ + oreseedX + " oreseedZ=" + oreseedZ);
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+ }
+ }
+ // Only add an empty orevein if are unable to place a vein
+ // at the oreseed chunk.
+ if ((!oreveinFound) && (this.mX == oreseedX) && (this.mZ == oreseedZ)) {
+ if (debugWorldGen)
+ GT_Log.out.println(" Empty oreveinSeed=" + oreveinSeed + " mX=" + this.mX + " mZ=" + this.mZ
+ + " oreseedX=" + oreseedX + " oreseedZ=" + oreseedZ + " tries at oremix=" + i
+ + " placementAttempts=" + placementAttempts + " dimensionName=" + tDimensionName);
+ validOreveins.put(oreveinSeed, noOresInVein);
+ }
+ } else if (oreveinPercentageRoll >= oreveinPercentage) {
+ if (debugWorldGen)
+ GT_Log.out.println(" Skipped oreveinSeed=" + oreveinSeed + " mX=" + this.mX + " mZ=" + this.mZ
+ + " oreseedX=" + oreseedX + " oreseedZ=" + oreseedZ + " RNG=" + oreveinPercentageRoll
+ + " %=" + oreveinPercentage + " dimensionName=" + tDimensionName);
+ validOreveins.put(oreveinSeed, noOresInVein);
+ }
+ } else {
+ // oreseed is located in the previously processed table
+ if (debugWorldGen)
+ GT_Log.out.print(" Valid oreveinSeed=" + oreveinSeed + " validOreveins.size()="
+ + validOreveins.size() + " ");
+ WorldGen_GT_Ore_Layer tWorldGen = validOreveins.get(oreveinSeed);
+ oreveinRNG.setSeed(oreveinSeed ^ (Block.getIdFromBlock(tWorldGen.mPrimaryMeta))); // Reset
+ // RNG
+ // to
+ // only
+ // be
+ // based
+ // on
+ // oreseed
+ // X/Z
+ // and
+ // type
+ // of
+ // vein
+ int placementResult = tWorldGen.executeWorldgenChunkified(
+ this.mWorld,
+ oreveinRNG,
+ this.mBiome,
+ this.mDimensionType,
+ this.mX * 16,
+ this.mZ * 16,
+ oreseedX * 16,
+ oreseedZ * 16,
+ this.mChunkGenerator,
+ this.mChunkProvider);
+ switch (placementResult) {
+ case WorldGen_GT_Ore_Layer.NO_ORE_IN_BOTTOM_LAYER:
+ if (debugWorldGen) GT_Log.out.println(" No ore in bottom layer");
+ break;
+ case WorldGen_GT_Ore_Layer.NO_OVERLAP:
+ if (debugWorldGen) GT_Log.out.println(" No overlap");
+ break;
+ }
+ }
+ }
+
+ @Override
+ public void run() {
+ long startTime = System.nanoTime();
+ int oreveinMaxSize;
+
+ // Determine bounding box on how far out to check for oreveins
+ // affecting this chunk
+ // For now, manually reducing oreveinMaxSize when not in the
+ // Underdark for performance
+ if (this.mWorld.provider.getDimensionName().equals("Underdark")) {
+ oreveinMaxSize = 24; // Leave Deep Dark/Underdark max oregen at
+ // 32, instead of 64
+ } else {
+ oreveinMaxSize = 48;
+ }
+
+ int wXbox = this.mX - (oreveinMaxSize / 16);
+ int eXbox = this.mX + (oreveinMaxSize / 16 + 1); // Need to add 1
+ // since it is
+ // compared
+ // using a <
+ int nZbox = this.mZ - (oreveinMaxSize / 16);
+ int sZbox = this.mZ + (oreveinMaxSize / 16 + 1);
+
+ // Search for orevein seeds and add to the list;
+ for (int x = wXbox; x < eXbox; x++) {
+ for (int z = nZbox; z < sZbox; z++) {
+ // Determine if this X/Z is an orevein seed
+ if (((Math.abs(x) % 3) == 1) && ((Math.abs(z) % 3) == 1)) {
+ if (debugWorldGen) GT_Log.out.println("Adding seed x=" + x + " z=" + z);
+ seedList.add(new NearbySeeds(x, z));
+ }
+ }
+ }
+
+ // Now process each oreseed vs this requested chunk
+ for (; seedList.size() != 0; seedList.remove(0)) {
+ if (debugWorldGen)
+ GT_Log.out.println("Processing seed x=" + seedList.get(0).mX + " z=" + seedList.get(0).mZ);
+ worldGenFindVein(seedList.get(0).mX, seedList.get(0).mZ);
+ }
+
+ long oregenTime = System.nanoTime();
+
+ // Do leftover worldgen for this chunk (GT_Stones and GT_small_ores)
+ try {
+ for (WorldGen_GT tWorldGen : HANDLER_GT.sWorldgenListEverglades) {
+ /*
+ * if (debugWorldGen) GT_Log.out.println(
+ * "tWorldGen.mWorldGenName="+tWorldGen.mWorldGenName );
+ */
+ tWorldGen.executeWorldgen(
+ this.mWorld,
+ this.mRandom,
+ this.mBiome,
+ this.mDimensionType,
+ this.mX * 16,
+ this.mZ * 16,
+ this.mChunkGenerator,
+ this.mChunkProvider);
+ }
+ } catch (Throwable e) {
+ e.printStackTrace(GT_Log.err);
+ }
+
+ long leftOverTime = System.nanoTime();
+
+ Chunk tChunk = this.mWorld.getChunkFromBlockCoords(this.mX, this.mZ);
+ if (tChunk != null) {
+ tChunk.isModified = true;
+ }
+ long endTime = System.nanoTime();
+ long duration = (endTime - startTime);
+ if (debugWorldGen) {
+ GT_Log.out.println(" Oregen took " + (oregenTime - startTime) + " Leftover gen took "
+ + (leftOverTime - oregenTime) + " Worldgen took " + duration + " nanoseconds");
+ }
+ }
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java
index 140098ee06..ee4dc51461 100644
--- a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java
+++ b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_GT_Ore_Layer.java
@@ -2,23 +2,11 @@ package gtPlusPlus.everglades.gen.gt;
import static gtPlusPlus.everglades.gen.gt.WorldGen_GT_Base.debugWorldGen;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.*;
-
-import net.minecraft.block.Block;
-import net.minecraft.init.Blocks;
-import net.minecraft.util.MathHelper;
-import net.minecraft.world.World;
-import net.minecraft.world.chunk.IChunkProvider;
-
import gregtech.api.GregTech_API;
import gregtech.api.enums.Materials;
import gregtech.api.util.GT_Log;
import gregtech.common.blocks.GT_Block_Ores;
import gregtech.common.blocks.GT_TileEntity_Ores;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
@@ -26,489 +14,606 @@ import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.everglades.dimension.Dimension_Everglades;
import gtPlusPlus.xmod.gregtech.HANDLER_GT;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.*;
+import net.minecraft.block.Block;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+import net.minecraft.world.chunk.IChunkProvider;
-public class WorldGen_GT_Ore_Layer
-extends WorldGen_GT {
- public static ArrayList<WorldGen_GT_Ore_Layer> sList = new ArrayList<WorldGen_GT_Ore_Layer>();
- public static int sWeight = 0;
- public final short mMinY;
- public final short mMaxY;
- public final short mWeight;
- public final short mDensity;
- public final short mSize;
- public Block mPrimaryMeta;
- public Block mSecondaryMeta;
- public Block mBetweenMeta;
- public Block mSporadicMeta;
- public final Material mPrimary;
- public final Material mSecondary;
- public final Material mBetween;
- public final Material mSporadic;
-
- public static boolean mUpdated = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK;
- public static final Block mStoneTypes;
-
- //public final String mBiome;
- public final String mRestrictBiome;
- public final boolean mOverworld;
- public final boolean mNether;
- public final boolean mEnd;
- public static final int WRONG_BIOME=0;
- public static final int WRONG_DIMENSION=1;
- public static final int NO_ORE_IN_BOTTOM_LAYER=2;
- public static final int NO_OVERLAP=3;
- public static final int ORE_PLACED=4;
- public static final int NO_OVERLAP_AIR_BLOCK=5;
-
- //public final boolean mMoon;
- //public final boolean mMars;
- //public final boolean mAsteroid;
- public final String aTextWorldgen = "worldgen.";
-
- static {
- if (mUpdated) {
- Object tempBlock = null;
- try {
- Field temp = ReflectionUtils.getField(GregTech_API.class, "sBlockStones");
- tempBlock = temp.get(null);
- }
- catch (IllegalArgumentException | IllegalAccessException e) {}
- mStoneTypes = (Block) tempBlock;
- }
- else {
- mStoneTypes = null;
- }
- }
-
-
- public WorldGen_GT_Ore_Layer(String aName, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) {
- this(aName, true, aMinY, aMaxY, aWeight, aDensity, aSize, false, false, false, false, false, false, aPrimary, aSecondary, aBetween, aSporadic);
- }
-
-
- public WorldGen_GT_Ore_Layer(String aName, boolean aDefault, int aMinY, int aMaxY, int aWeight, int aDensity, int aSize, boolean aOverworld, boolean aNether, boolean aEnd, boolean GC_UNUSED1, boolean GC_UNUSED2, boolean GC_UNUSED3, Material aPrimary, Material aSecondary, Material aBetween, Material aSporadic) {
- super(aName, sList, aDefault);
- Logger.WORLD("Creating Ore Layer Object");
- this.mOverworld = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld);
- this.mNether = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether);
- this.mEnd = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd);
- //this.mMoon = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Moon", aMoon);
- //this.mMars = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Mars", aMars);
- //this.mAsteroid = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Asteroid", aAsteroid);
- this.mMinY = 5;
- short mMaxY = 14;
- if (mMaxY < (this.mMinY + 7)) {
- GT_Log.out.println(
- "Oremix " + this.mWorldGenName +
- " has invalid Min/Max heights!"
- );
- mMaxY = (short) (this.mMinY + 7);
- }
- this.mMaxY = mMaxY;
- this.mWeight = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight));
- this.mDensity = ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity));
- this.mSize = ((short) Math.max(1, HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize)));
- this.mPrimary = aPrimary;
- this.mSecondary = aSecondary;
- this.mBetween = aBetween;
- this.mSporadic = aSporadic;
- this.mPrimaryMeta = aPrimary.getOreBlock(1);
- this.mSecondaryMeta = aSecondary.getOreBlock(1);
- this.mBetweenMeta = aBetween.getOreBlock(1);
- this.mSporadicMeta = aSporadic.getOreBlock(1);
- this.mRestrictBiome = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None");
-
- //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mPrimaryMeta + " for " + mWorldGenName + " does not exist");
- //if (mSecondaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSecondaryMeta + " for " + mWorldGenName + " does not exist");
- //if (mBetweenMeta != -1 && GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mBetweenMeta + " for " + mWorldGenName + " does not exist");
- //if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)] == null) throw new IllegalArgumentException("A Material for the supplied ID " + mSporadicMeta + " for " + mWorldGenName + " does not exist");
-
- if (this.mEnabled) {
- //GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
- //GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
- //GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
- //GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY, aWeight, aOverworld, aNether, aEnd);
- sWeight += this.mWeight;
- }
- }
-
- public int executeWorldgenChunkified(World aWorld, Random aRandom, String aBiome, int aDimensionType, int aChunkX, int aChunkZ, int aSeedX, int aSeedZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) {
-
- //Debug Handler
- /**
- * This handles Variables that are null during Init
- */
-
- if (this.mPrimaryMeta == Blocks.stone || this.mSecondaryMeta == Blocks.stone
- || this.mBetweenMeta == Blocks.stone || this.mSporadicMeta == Blocks.stone){
- this.mPrimaryMeta = this.mPrimary.getOreBlock(1);
- this.mSecondaryMeta = this.mSecondary.getOreBlock(1);
- this.mBetweenMeta = this.mBetween.getOreBlock(1);
- this.mSporadicMeta = this.mSporadic.getOreBlock(1);
- Logger.WORLD("[Vein Generator] An Ore in a Vein had defaulted back to a default value, so they have now been reset to correct values.");
- }
-
- if( mWorldGenName.equals("vein0") ) {
- if (debugWorldGen) GT_Log.out.println(
- " NoOresInVein-vein0"
- );
- // This is a special empty orevein
- Logger.WORLD("[World Generation Debug] Special Empty Vein placed.");
- return ORE_PLACED;
- }
- if (aDimensionType != Dimension_Everglades.DIMID) {
- /* // Debug code, but spams log
- if (debugWorldGen) {
- GT_Log.out.println(
- "Wrong dimension"
- );
+public class WorldGen_GT_Ore_Layer extends WorldGen_GT {
+ public static ArrayList<WorldGen_GT_Ore_Layer> sList = new ArrayList<WorldGen_GT_Ore_Layer>();
+ public static int sWeight = 0;
+ public final short mMinY;
+ public final short mMaxY;
+ public final short mWeight;
+ public final short mDensity;
+ public final short mSize;
+ public Block mPrimaryMeta;
+ public Block mSecondaryMeta;
+ public Block mBetweenMeta;
+ public Block mSporadicMeta;
+ public final Material mPrimary;
+ public final Material mSecondary;
+ public final Material mBetween;
+ public final Material mSporadic;
+
+ public static boolean mUpdated = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK;
+ public static final Block mStoneTypes;
+
+ // public final String mBiome;
+ public final String mRestrictBiome;
+ public final boolean mOverworld;
+ public final boolean mNether;
+ public final boolean mEnd;
+ public static final int WRONG_BIOME = 0;
+ public static final int WRONG_DIMENSION = 1;
+ public static final int NO_ORE_IN_BOTTOM_LAYER = 2;
+ public static final int NO_OVERLAP = 3;
+ public static final int ORE_PLACED = 4;
+ public static final int NO_OVERLAP_AIR_BLOCK = 5;
+
+ // public final boolean mMoon;
+ // public final boolean mMars;
+ // public final boolean mAsteroid;
+ public final String aTextWorldgen = "worldgen.";
+
+ static {
+ if (mUpdated) {
+ Object tempBlock = null;
+ try {
+ Field temp = ReflectionUtils.getField(GregTech_API.class, "sBlockStones");
+ tempBlock = temp.get(null);
+ } catch (IllegalArgumentException | IllegalAccessException e) {
}
- */
- Logger.WORLD("[World Generation Debug] Wrong dimension.");
- return WRONG_DIMENSION;
- }
- if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) {
- return WRONG_BIOME;
- }
- int[] placeCount=new int[4];
-
- int tMinY = mMinY + aRandom.nextInt(mMaxY - mMinY - 5);
- // Determine West/East ends of orevein
- int wXVein = aSeedX - aRandom.nextInt(mSize); // West side
- int eXVein = aSeedX + 16 + aRandom.nextInt(mSize);
- // Limit Orevein to only blocks present in current chunk
- int wX = Math.max( wXVein, aChunkX + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
- int eX = Math.min( eXVein, aChunkX + 2 + 16);
- if (wX >= eX) { //No overlap between orevein and this chunk exists in X
- Block tBlock = aWorld.getBlock(aChunkX + 8, tMinY, aChunkZ + 8);
- if (tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Blocks.stone) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Dimension_Everglades.blockSecondLayer) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Dimension_Everglades.blockMainFiller) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Dimension_Everglades.blockSecondaryFiller) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Blocks.netherrack) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Blocks.end_stone) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, GregTech_API.sBlockGranites) ||
- (mUpdated && tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, mStoneTypes)) ) {
- // Didn't reach, but could have placed. Save orevein for future use.
- return NO_OVERLAP;
- } else {
- // Didn't reach, but couldn't place in test spot anywys, try for another orevein
- return NO_OVERLAP_AIR_BLOCK;
- }
- }
- // Determine North/Sound ends of orevein
- int nZVein = aSeedZ - aRandom.nextInt(mSize);
- int sZVein = aSeedZ + 16 + aRandom.nextInt(mSize);
-
- int nZ = Math.max(nZVein, aChunkZ + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
- int sZ = Math.min(sZVein, aChunkZ + 2 + 16);
- if (nZ >= sZ) { //No overlap between orevein and this chunk exists in Z
- Block tBlock = aWorld.getBlock(aChunkX + 8, tMinY, aChunkZ + 8);
- if (tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Blocks.stone) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Blocks.netherrack) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, Blocks.end_stone) ||
- tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, GregTech_API.sBlockGranites) ||
- (mUpdated && tBlock.isReplaceableOreGen(aWorld, aChunkX+8, tMinY, aChunkZ + 8, mStoneTypes)) ) {
- // Didn't reach, but could have placed. Save orevein for future use.
- return NO_OVERLAP;
- } else {
- // Didn't reach, but couldn't place in test spot anywys, try for another orevein
- return NO_OVERLAP_AIR_BLOCK;
- }
-
- }
-
- if (debugWorldGen) {
- String tDimensionName = aWorld.provider.getDimensionName();
- GT_Log.out.print(
- "Trying Orevein:" + this.mWorldGenName +
- " Dimension=" + tDimensionName +
- " mX="+aChunkX/16+
- " mZ="+aChunkZ/16+
- " oreseedX="+ aSeedX/16 +
- " oreseedZ="+ aSeedZ/16 +
- " cY="+tMinY
- );
- }
- // Adjust the density down the more chunks we are away from the oreseed. The 5 chunks surrounding the seed should always be max density due to truncation of Math.sqrt().
- int localDensity = (Math.max(1, this.mDensity / ((int)Math.sqrt(2 + Math.pow(aChunkX/16 - aSeedX/16, 2) + Math.pow(aChunkZ/16 - aSeedZ/16, 2)))));
-
- // To allow for early exit due to no ore placed in the bottom layer (probably because we are in the sky), unroll 1 pass through the loop
- // Now we do bottom-level-first oregen, and work our way upwards.
- int level = tMinY - 1; //Dunno why, but the first layer is actually played one below tMinY. Go figure.
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta != null) ) {
- if (setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
- placeCount[1]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- /*if ((placeCount[1]+placeCount[3])==0) {
+ mStoneTypes = (Block) tempBlock;
+ } else {
+ mStoneTypes = null;
+ }
+ }
+
+ public WorldGen_GT_Ore_Layer(
+ String aName,
+ int aMinY,
+ int aMaxY,
+ int aWeight,
+ int aDensity,
+ int aSize,
+ Material aPrimary,
+ Material aSecondary,
+ Material aBetween,
+ Material aSporadic) {
+ this(
+ aName,
+ true,
+ aMinY,
+ aMaxY,
+ aWeight,
+ aDensity,
+ aSize,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ aPrimary,
+ aSecondary,
+ aBetween,
+ aSporadic);
+ }
+
+ public WorldGen_GT_Ore_Layer(
+ String aName,
+ boolean aDefault,
+ int aMinY,
+ int aMaxY,
+ int aWeight,
+ int aDensity,
+ int aSize,
+ boolean aOverworld,
+ boolean aNether,
+ boolean aEnd,
+ boolean GC_UNUSED1,
+ boolean GC_UNUSED2,
+ boolean GC_UNUSED3,
+ Material aPrimary,
+ Material aSecondary,
+ Material aBetween,
+ Material aSporadic) {
+ super(aName, sList, aDefault);
+ Logger.WORLD("Creating Ore Layer Object");
+ this.mOverworld =
+ HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Overworld", aOverworld);
+ this.mNether = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Nether", aNether);
+ this.mEnd = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "TheEnd", aEnd);
+ // this.mMoon = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Moon", aMoon);
+ // this.mMars = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Mars", aMars);
+ // this.mAsteroid = HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Asteroid",
+ // aAsteroid);
+ this.mMinY = 5;
+ short mMaxY = 14;
+ if (mMaxY < (this.mMinY + 7)) {
+ GT_Log.out.println("Oremix " + this.mWorldGenName + " has invalid Min/Max heights!");
+ mMaxY = (short) (this.mMinY + 7);
+ }
+ this.mMaxY = mMaxY;
+ this.mWeight = ((short)
+ HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RandomWeight", aWeight));
+ this.mDensity =
+ ((short) HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Density", aDensity));
+ this.mSize = ((short)
+ Math.max(1, HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "Size", aSize)));
+ this.mPrimary = aPrimary;
+ this.mSecondary = aSecondary;
+ this.mBetween = aBetween;
+ this.mSporadic = aSporadic;
+ this.mPrimaryMeta = aPrimary.getOreBlock(1);
+ this.mSecondaryMeta = aSecondary.getOreBlock(1);
+ this.mBetweenMeta = aBetween.getOreBlock(1);
+ this.mSporadicMeta = aSporadic.getOreBlock(1);
+ this.mRestrictBiome =
+ HANDLER_GT.sCustomWorldgenFile.get(aTextWorldgen + this.mWorldGenName, "RestrictToBiomeName", "None");
+
+ // if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)] == null) throw new
+ // IllegalArgumentException("A Material for the supplied ID " + mPrimaryMeta + " for " + mWorldGenName + " does
+ // not exist");
+ // if (mSecondaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)] == null) throw new
+ // IllegalArgumentException("A Material for the supplied ID " + mSecondaryMeta + " for " + mWorldGenName + "
+ // does not exist");
+ // if (mBetweenMeta != -1 && GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)] == null) throw new
+ // IllegalArgumentException("A Material for the supplied ID " + mBetweenMeta + " for " + mWorldGenName + " does
+ // not exist");
+ // if (mPrimaryMeta != -1 && GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)] == null) throw new
+ // IllegalArgumentException("A Material for the supplied ID " + mSporadicMeta + " for " + mWorldGenName + " does
+ // not exist");
+
+ if (this.mEnabled) {
+ // GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mPrimaryMeta % 1000)], aMinY, aMaxY,
+ // aWeight, aOverworld, aNether, aEnd);
+ // GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSecondaryMeta % 1000)], aMinY, aMaxY,
+ // aWeight, aOverworld, aNether, aEnd);
+ // GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mBetweenMeta % 1000)], aMinY, aMaxY,
+ // aWeight, aOverworld, aNether, aEnd);
+ // GT_Achievements.registerOre(GregTech_API.sGeneratedMaterials[(mSporadicMeta % 1000)], aMinY, aMaxY,
+ // aWeight, aOverworld, aNether, aEnd);
+ sWeight += this.mWeight;
+ }
+ }
+
+ public int executeWorldgenChunkified(
+ World aWorld,
+ Random aRandom,
+ String aBiome,
+ int aDimensionType,
+ int aChunkX,
+ int aChunkZ,
+ int aSeedX,
+ int aSeedZ,
+ IChunkProvider aChunkGenerator,
+ IChunkProvider aChunkProvider) {
+
+ // Debug Handler
+ /**
+ * This handles Variables that are null during Init
+ */
+ if (this.mPrimaryMeta == Blocks.stone
+ || this.mSecondaryMeta == Blocks.stone
+ || this.mBetweenMeta == Blocks.stone
+ || this.mSporadicMeta == Blocks.stone) {
+ this.mPrimaryMeta = this.mPrimary.getOreBlock(1);
+ this.mSecondaryMeta = this.mSecondary.getOreBlock(1);
+ this.mBetweenMeta = this.mBetween.getOreBlock(1);
+ this.mSporadicMeta = this.mSporadic.getOreBlock(1);
+ Logger.WORLD(
+ "[Vein Generator] An Ore in a Vein had defaulted back to a default value, so they have now been reset to correct values.");
+ }
+
+ if (mWorldGenName.equals("vein0")) {
+ if (debugWorldGen) GT_Log.out.println(" NoOresInVein-vein0");
+ // This is a special empty orevein
+ Logger.WORLD("[World Generation Debug] Special Empty Vein placed.");
+ return ORE_PLACED;
+ }
+ if (aDimensionType != Dimension_Everglades.DIMID) {
+ /* // Debug code, but spams log
+ if (debugWorldGen) {
+ GT_Log.out.println(
+ "Wrong dimension"
+ );
+ }
+ */
+ Logger.WORLD("[World Generation Debug] Wrong dimension.");
+ return WRONG_DIMENSION;
+ }
+ if (!this.mRestrictBiome.equals("None") && !(this.mRestrictBiome.equals(aBiome))) {
+ return WRONG_BIOME;
+ }
+ int[] placeCount = new int[4];
+
+ int tMinY = mMinY + aRandom.nextInt(mMaxY - mMinY - 5);
+ // Determine West/East ends of orevein
+ int wXVein = aSeedX - aRandom.nextInt(mSize); // West side
+ int eXVein = aSeedX + 16 + aRandom.nextInt(mSize);
+ // Limit Orevein to only blocks present in current chunk
+ int wX = Math.max(wXVein, aChunkX + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
+ int eX = Math.min(eXVein, aChunkX + 2 + 16);
+ if (wX >= eX) { // No overlap between orevein and this chunk exists in X
+ Block tBlock = aWorld.getBlock(aChunkX + 8, tMinY, aChunkZ + 8);
+ if (tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Blocks.stone)
+ || tBlock.isReplaceableOreGen(
+ aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Dimension_Everglades.blockSecondLayer)
+ || tBlock.isReplaceableOreGen(
+ aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Dimension_Everglades.blockMainFiller)
+ || tBlock.isReplaceableOreGen(
+ aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Dimension_Everglades.blockSecondaryFiller)
+ || tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Blocks.netherrack)
+ || tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Blocks.end_stone)
+ || tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, GregTech_API.sBlockGranites)
+ || (mUpdated && tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, mStoneTypes))) {
+ // Didn't reach, but could have placed. Save orevein for future use.
+ return NO_OVERLAP;
+ } else {
+ // Didn't reach, but couldn't place in test spot anywys, try for another orevein
+ return NO_OVERLAP_AIR_BLOCK;
+ }
+ }
+ // Determine North/Sound ends of orevein
+ int nZVein = aSeedZ - aRandom.nextInt(mSize);
+ int sZVein = aSeedZ + 16 + aRandom.nextInt(mSize);
+
+ int nZ = Math.max(nZVein, aChunkZ + 2); // Bias placement by 2 blocks to prevent worldgen cascade.
+ int sZ = Math.min(sZVein, aChunkZ + 2 + 16);
+ if (nZ >= sZ) { // No overlap between orevein and this chunk exists in Z
+ Block tBlock = aWorld.getBlock(aChunkX + 8, tMinY, aChunkZ + 8);
+ if (tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Blocks.stone)
+ || tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Blocks.netherrack)
+ || tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, Blocks.end_stone)
+ || tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, GregTech_API.sBlockGranites)
+ || (mUpdated && tBlock.isReplaceableOreGen(aWorld, aChunkX + 8, tMinY, aChunkZ + 8, mStoneTypes))) {
+ // Didn't reach, but could have placed. Save orevein for future use.
+ return NO_OVERLAP;
+ } else {
+ // Didn't reach, but couldn't place in test spot anywys, try for another orevein
+ return NO_OVERLAP_AIR_BLOCK;
+ }
+ }
+
+ if (debugWorldGen) {
+ String tDimensionName = aWorld.provider.getDimensionName();
+ GT_Log.out.print("Trying Orevein:" + this.mWorldGenName + " Dimension="
+ + tDimensionName + " mX="
+ + aChunkX / 16 + " mZ="
+ + aChunkZ / 16 + " oreseedX="
+ + aSeedX / 16 + " oreseedZ="
+ + aSeedZ / 16 + " cY="
+ + tMinY);
+ }
+ // Adjust the density down the more chunks we are away from the oreseed. The 5 chunks surrounding the seed
+ // should always be max density due to truncation of Math.sqrt().
+ int localDensity = (Math.max(
+ 1,
+ this.mDensity
+ / ((int) Math.sqrt(2
+ + Math.pow(aChunkX / 16 - aSeedX / 16, 2)
+ + Math.pow(aChunkZ / 16 - aSeedZ / 16, 2)))));
+
+ // To allow for early exit due to no ore placed in the bottom layer (probably because we are in the sky), unroll
+ // 1 pass through the loop
+ // Now we do bottom-level-first oregen, and work our way upwards.
+ int level = tMinY - 1; // Dunno why, but the first layer is actually played one below tMinY. Go figure.
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(
+ 1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX)) / localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(
+ 1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ)) / localDensity);
+ if (((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mSecondaryMeta != null)) {
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
+ placeCount[1]++;
+ }
+ } else if ((aRandom.nextInt(7) == 0)
+ && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mSporadicMeta
+ != null)) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to
+ // compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++;
+ }
+ }
+ }
+ /*if ((placeCount[1]+placeCount[3])==0) {
if (debugWorldGen) GT_Log.out.println(
" No ore in bottom layer"
);
return NO_ORE_IN_BOTTOM_LAYER; // Exit early, didn't place anything in the bottom layer
}*/
- Logger.WORLD("[World Generation Debug] Trying to set Ores?");
- for (level = tMinY; level < (tMinY-1+3); level++) {
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSecondaryMeta != null) ) {
- if (setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
- placeCount[1]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- }
- // Low Middle layer is between + sporadic
- // level should be = tMinY-1+3 from end of for loop
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta != null) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
- placeCount[2]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- // High Middle layer is between + primary + sporadic
- level++; // Increment level to next layer
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ((aRandom.nextInt(2) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mBetweenMeta != null) ) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
- placeCount[2]++;
- }
- }
- else if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta != null) ) {
- if (setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
- placeCount[0]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- // Top two layers are primary + sporadic
- level++; // Increment level to next layer
- for( ; level < (tMinY + 6); level++){ // should do two layers
- for (int tX = wX; tX < eX; tX++) {
- int placeX = Math.max(1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX))/localDensity);
- for (int tZ = nZ; tZ < sZ; tZ++) {
- int placeZ = Math.max(1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ))/localDensity);
- if ( ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mPrimaryMeta != null) ) {
- if (setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
- placeCount[0]++;
- }
- }
- else if ((aRandom.nextInt(7) == 0) && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0)) && (this.mSporadicMeta != null) ) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to compensate
- if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false))
- placeCount[3]++;
- }
- }
- }
- }
- if (debugWorldGen) {
- String tDimensionName = aWorld.provider.getDimensionName();
- GT_Log.out.println(
- "Generated Orevein:" + this.mWorldGenName +
- " Dimension=" + tDimensionName +
- " mX="+aChunkX/16+
- " mZ="+aChunkZ/16+
- " oreseedX="+ aSeedX/16 +
- " oreseedZ="+ aSeedZ/16 +
- " cY="+tMinY+
- " wXVein" + wXVein +
- " eXVein" + eXVein +
- " nZVein" + nZVein +
- " sZVein" + sZVein +
- " locDen=" + localDensity +
- " Den=" + this.mDensity +
- " Sec="+placeCount[1]+
- " Spo="+placeCount[3]+
- " Bet="+placeCount[2]+
- " Pri="+placeCount[0]
- );
- }
- // Something (at least the bottom layer must have 1 block) must have been placed, return true
- return ORE_PLACED;
- }
-
- private String fString = "unset", ore1String = "unset", ore2String = "unset", ore3String = "unset", ore4String = "unset";
- Map<Materials, String> gtOreMap = new HashMap<Materials, String>();
-
- @SuppressWarnings("deprecation")
- public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData, boolean isSmallOre,
- boolean air) {
- if (!air) {
- aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1));
- }
-
- //Set GT ORE
- if (aMetaData instanceof GT_Block_Ores){
- if (ore1String.equals("unset")) {
- ore1String = Utils.sanitizeString(this.mPrimary.getLocalizedName().toLowerCase());
- }
- if (ore2String.equals("unset")) {
- ore2String = Utils.sanitizeString(this.mSecondaryMeta.getLocalizedName().toLowerCase());
- }
- if (ore3String.equals("unset")) {
- ore3String = Utils.sanitizeString(this.mBetweenMeta.getLocalizedName().toLowerCase());
- }
- if (ore4String.equals("unset")) {
- ore4String = Utils.sanitizeString(this.mSporadicMeta.getLocalizedName().toLowerCase());
- }
-
- if (this.mPrimaryMeta == aMetaData){
- for (Materials f : Materials.values()){
- if (!gtOreMap.containsKey(f)) {
- gtOreMap.put(f, Utils.sanitizeString(f.name().toLowerCase()));
- }
- fString = gtOreMap.get(f);
- if (fString.contains(ore1String)){
- int r = f.mMetaItemSubID;
- if (setOreBlock(aWorld, aX, aY, aZ, r, false)){
- Logger.WORLD("[World Generation Debug] Set "+f.mDefaultLocalName+" Ore at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
- return true;
- }
- }
- }
- }
- if (this.mSecondaryMeta == aMetaData){
- for (Materials f : Materials.values()){
- if (!gtOreMap.containsKey(f)) {
- gtOreMap.put(f, Utils.sanitizeString(f.name().toLowerCase()));
- }
- fString = gtOreMap.get(f);
- if (fString.contains(ore2String)){
- int r = f.mMetaItemSubID;
- if (setOreBlock(aWorld, aX, aY, aZ, r, false)){
- Logger.WORLD("[World Generation Debug] Set "+f.mDefaultLocalName+" Ore at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
- return true;
- }
- }
- }
- }
- if (this.mBetweenMeta == aMetaData){
- for (Materials f : Materials.values()){
- if (!gtOreMap.containsKey(f)) {
- gtOreMap.put(f, Utils.sanitizeString(f.name().toLowerCase()));
- }
- fString = gtOreMap.get(f);
- if (fString.contains(ore3String)){
- int r = f.mMetaItemSubID;
- if (setOreBlock(aWorld, aX, aY, aZ, r, false)){
- Logger.WORLD("[World Generation Debug] Set "+f.mDefaultLocalName+" Ore at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
- return true;
- }
- }
- }
- }
- if (this.mSporadicMeta == aMetaData){
- for (Materials f : Materials.values()){
- if (!gtOreMap.containsKey(f)) {
- gtOreMap.put(f, Utils.sanitizeString(f.name().toLowerCase()));
- }
- fString = gtOreMap.get(f);
- if (fString.contains(ore4String)){
- int r = f.mMetaItemSubID;
- if (setOreBlock(aWorld, aX, aY, aZ, r, false)){
- Logger.WORLD("[World Generation Debug] Set "+f.mDefaultLocalName+" Ore at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
- return true;
- }
- }
- }
- }
-
- }
-
- Block tBlock = aWorld.getBlock(aX, aY, aZ);
- Block tOreBlock = aMetaData;
- int BlockMeta = aWorld.getBlockMetadata(aX, aY, aZ);
- String BlockName = tBlock.getUnlocalizedName();
- if (
- tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone) ||
- tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.sand) ||
- tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt) ||
- tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites) ||
- (mUpdated && tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, mStoneTypes)) ||
- tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Dimension_Everglades.blockSecondLayer) ||
- tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Dimension_Everglades.blockMainFiller) ||
- tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Dimension_Everglades.blockSecondaryFiller) ||
- tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.sandstone)) {
-
- if (aWorld.setBlock(aX, aY, aZ, tOreBlock, 0, 3)){
- Logger.WORLD("[World Generation Debug] Set "+tOreBlock.getLocalizedName()+" at X: "+aX+" | Y: "+aY+" | Z: "+aZ);
- return true;
- }
- }
- return false;
- }
-
+ Logger.WORLD("[World Generation Debug] Trying to set Ores?");
+ for (level = tMinY; level < (tMinY - 1 + 3); level++) {
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(
+ 1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX)) / localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(
+ 1,
+ Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ)) / localDensity);
+ if (((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mSecondaryMeta != null)) {
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSecondaryMeta, false, false)) {
+ placeCount[1]++;
+ }
+ } else if ((aRandom.nextInt(7) == 0)
+ && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mSporadicMeta
+ != null)) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to
+ // compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++;
+ }
+ }
+ }
+ }
+ // Low Middle layer is between + sporadic
+ // level should be = tMinY-1+3 from end of for loop
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(
+ 1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX)) / localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(
+ 1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ)) / localDensity);
+ if ((aRandom.nextInt(2) == 0)
+ && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mBetweenMeta
+ != null)) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
+ placeCount[2]++;
+ }
+ } else if ((aRandom.nextInt(7) == 0)
+ && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mSporadicMeta
+ != null)) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to
+ // compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++;
+ }
+ }
+ }
+ // High Middle layer is between + primary + sporadic
+ level++; // Increment level to next layer
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(
+ 1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX)) / localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(
+ 1, Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ)) / localDensity);
+ if ((aRandom.nextInt(2) == 0)
+ && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mBetweenMeta
+ != null)) { // Between are only 1 per vertical column, reduce by 1/2 to compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mBetweenMeta, false, false)) {
+ placeCount[2]++;
+ }
+ } else if (((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mPrimaryMeta != null)) {
+ if (setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
+ placeCount[0]++;
+ }
+ } else if ((aRandom.nextInt(7) == 0)
+ && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mSporadicMeta
+ != null)) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to
+ // compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++;
+ }
+ }
+ }
+ // Top two layers are primary + sporadic
+ level++; // Increment level to next layer
+ for (; level < (tMinY + 6); level++) { // should do two layers
+ for (int tX = wX; tX < eX; tX++) {
+ int placeX = Math.max(
+ 1, Math.max(MathHelper.abs_int(wXVein - tX), MathHelper.abs_int(eXVein - tX)) / localDensity);
+ for (int tZ = nZ; tZ < sZ; tZ++) {
+ int placeZ = Math.max(
+ 1,
+ Math.max(MathHelper.abs_int(sZVein - tZ), MathHelper.abs_int(nZVein - tZ)) / localDensity);
+ if (((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mPrimaryMeta != null)) {
+ if (setOreBlock(aWorld, tX, level, tZ, this.mPrimaryMeta, false, false)) {
+ placeCount[0]++;
+ }
+ } else if ((aRandom.nextInt(7) == 0)
+ && ((aRandom.nextInt(placeZ) == 0) || (aRandom.nextInt(placeX) == 0))
+ && (this.mSporadicMeta
+ != null)) { // Sporadics are only 1 per vertical column normally, reduce by 1/7 to
+ // compensate
+ if (setOreBlock(aWorld, tX, level, tZ, this.mSporadicMeta, false, false)) placeCount[3]++;
+ }
+ }
+ }
+ }
+ if (debugWorldGen) {
+ String tDimensionName = aWorld.provider.getDimensionName();
+ GT_Log.out.println("Generated Orevein:" + this.mWorldGenName + " Dimension="
+ + tDimensionName + " mX="
+ + aChunkX / 16 + " mZ="
+ + aChunkZ / 16 + " oreseedX="
+ + aSeedX / 16 + " oreseedZ="
+ + aSeedZ / 16 + " cY="
+ + tMinY + " wXVein"
+ + wXVein + " eXVein"
+ + eXVein + " nZVein"
+ + nZVein + " sZVein"
+ + sZVein + " locDen="
+ + localDensity + " Den="
+ + this.mDensity + " Sec="
+ + placeCount[1] + " Spo="
+ + placeCount[3] + " Bet="
+ + placeCount[2] + " Pri="
+ + placeCount[0]);
+ }
+ // Something (at least the bottom layer must have 1 block) must have been placed, return true
+ return ORE_PLACED;
+ }
+
+ private String fString = "unset",
+ ore1String = "unset",
+ ore2String = "unset",
+ ore3String = "unset",
+ ore4String = "unset";
+ Map<Materials, String> gtOreMap = new HashMap<Materials, String>();
+
+ @SuppressWarnings("deprecation")
+ public boolean setOreBlock(World aWorld, int aX, int aY, int aZ, Block aMetaData, boolean isSmallOre, boolean air) {
+ if (!air) {
+ aY = Math.min(aWorld.getActualHeight(), Math.max(aY, 1));
+ }
+
+ // Set GT ORE
+ if (aMetaData instanceof GT_Block_Ores) {
+ if (ore1String.equals("unset")) {
+ ore1String =
+ Utils.sanitizeString(this.mPrimary.getLocalizedName().toLowerCase());
+ }
+ if (ore2String.equals("unset")) {
+ ore2String = Utils.sanitizeString(
+ this.mSecondaryMeta.getLocalizedName().toLowerCase());
+ }
+ if (ore3String.equals("unset")) {
+ ore3String = Utils.sanitizeString(
+ this.mBetweenMeta.getLocalizedName().toLowerCase());
+ }
+ if (ore4String.equals("unset")) {
+ ore4String = Utils.sanitizeString(
+ this.mSporadicMeta.getLocalizedName().toLowerCase());
+ }
- private boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int mMetaItemSubID, boolean useless){
+ if (this.mPrimaryMeta == aMetaData) {
+ for (Materials f : Materials.values()) {
+ if (!gtOreMap.containsKey(f)) {
+ gtOreMap.put(f, Utils.sanitizeString(f.name().toLowerCase()));
+ }
+ fString = gtOreMap.get(f);
+ if (fString.contains(ore1String)) {
+ int r = f.mMetaItemSubID;
+ if (setOreBlock(aWorld, aX, aY, aZ, r, false)) {
+ Logger.WORLD("[World Generation Debug] Set " + f.mDefaultLocalName + " Ore at X: " + aX
+ + " | Y: " + aY + " | Z: " + aZ);
+ return true;
+ }
+ }
+ }
+ }
+ if (this.mSecondaryMeta == aMetaData) {
+ for (Materials f : Materials.values()) {
+ if (!gtOreMap.containsKey(f)) {
+ gtOreMap.put(f, Utils.sanitizeString(f.name().toLowerCase()));
+ }
+ fString = gtOreMap.get(f);
+ if (fString.contains(ore2String)) {
+ int r = f.mMetaItemSubID;
+ if (setOreBlock(aWorld, aX, aY, aZ, r, false)) {
+ Logger.WORLD("[World Generation Debug] Set " + f.mDefaultLocalName + " Ore at X: " + aX
+ + " | Y: " + aY + " | Z: " + aZ);
+ return true;
+ }
+ }
+ }
+ }
+ if (this.mBetweenMeta == aMetaData) {
+ for (Materials f : Materials.values()) {
+ if (!gtOreMap.containsKey(f)) {
+ gtOreMap.put(f, Utils.sanitizeString(f.name().toLowerCase()));
+ }
+ fString = gtOreMap.get(f);
+ if (fString.contains(ore3String)) {
+ int r = f.mMetaItemSubID;
+ if (setOreBlock(aWorld, aX, aY, aZ, r, false)) {
+ Logger.WORLD("[World Generation Debug] Set " + f.mDefaultLocalName + " Ore at X: " + aX
+ + " | Y: " + aY + " | Z: " + aZ);
+ return true;
+ }
+ }
+ }
+ }
+ if (this.mSporadicMeta == aMetaData) {
+ for (Materials f : Materials.values()) {
+ if (!gtOreMap.containsKey(f)) {
+ gtOreMap.put(f, Utils.sanitizeString(f.name().toLowerCase()));
+ }
+ fString = gtOreMap.get(f);
+ if (fString.contains(ore4String)) {
+ int r = f.mMetaItemSubID;
+ if (setOreBlock(aWorld, aX, aY, aZ, r, false)) {
+ Logger.WORLD("[World Generation Debug] Set " + f.mDefaultLocalName + " Ore at X: " + aX
+ + " | Y: " + aY + " | Z: " + aZ);
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ Block tBlock = aWorld.getBlock(aX, aY, aZ);
+ Block tOreBlock = aMetaData;
+ int BlockMeta = aWorld.getBlockMetadata(aX, aY, aZ);
+ String BlockName = tBlock.getUnlocalizedName();
+ if (tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.stone)
+ || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.sand)
+ || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.dirt)
+ || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, GregTech_API.sBlockGranites)
+ || (mUpdated && tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, mStoneTypes))
+ || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Dimension_Everglades.blockSecondLayer)
+ || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Dimension_Everglades.blockMainFiller)
+ || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Dimension_Everglades.blockSecondaryFiller)
+ || tBlock.isReplaceableOreGen(aWorld, aX, aY, aZ, Blocks.sandstone)) {
+
+ if (aWorld.setBlock(aX, aY, aZ, tOreBlock, 0, 3)) {
+ Logger.WORLD("[World Generation Debug] Set " + tOreBlock.getLocalizedName() + " at X: " + aX + " | Y: "
+ + aY + " | Z: " + aZ);
+ return true;
+ }
+ }
+ return false;
+ }
- //Get Class and Methods
- Method setOres = null;
- boolean is08 = !CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK;
+ private boolean setOreBlock(World aWorld, int aX, int aY, int aZ, int mMetaItemSubID, boolean useless) {
- //GT 5.08
- if (is08){
- try {
- setOres = GT_TileEntity_Ores.class.getDeclaredMethod("setOreBlock", World.class, int.class, int.class, int.class, int.class);
- }
- catch (NoSuchMethodException | SecurityException e) {
+ // Get Class and Methods
+ Method setOres = null;
+ boolean is08 = !CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK;
- }
- }
- //GT 5.09
- else {
- try {
- setOres = GT_TileEntity_Ores.class.getDeclaredMethod("setOreBlock", World.class, int.class, int.class, int.class, int.class, boolean.class);
- }
- catch (NoSuchMethodException | SecurityException e) {
+ // GT 5.08
+ if (is08) {
+ try {
+ setOres = GT_TileEntity_Ores.class.getDeclaredMethod(
+ "setOreBlock", World.class, int.class, int.class, int.class, int.class);
+ } catch (NoSuchMethodException | SecurityException e) {
- }
- }
+ }
+ }
+ // GT 5.09
+ else {
+ try {
+ setOres = GT_TileEntity_Ores.class.getDeclaredMethod(
+ "setOreBlock", World.class, int.class, int.class, int.class, int.class, boolean.class);
+ } catch (NoSuchMethodException | SecurityException e) {
- try {
- if (is08 && setOres != null){
- setOres.invoke(null, aWorld, aX, aY, aZ, mMetaItemSubID);
- }
- else if (!is08 && setOres != null){
- setOres.invoke(null, aWorld, aX, aY, aZ, mMetaItemSubID, useless);
- }
- else {
- return false;
- }}
- catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ }
+ }
+
+ try {
+ if (is08 && setOres != null) {
+ setOres.invoke(null, aWorld, aX, aY, aZ, mMetaItemSubID);
+ } else if (!is08 && setOres != null) {
+ setOres.invoke(null, aWorld, aX, aY, aZ, mMetaItemSubID, useless);
+ } else {
+ return false;
+ }
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- }
- return false;
- }
-} \ No newline at end of file
+ }
+ return false;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java
index 0715f86e01..77676d8cfa 100644
--- a/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java
+++ b/src/main/java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java
@@ -1,97 +1,101 @@
package gtPlusPlus.everglades.gen.gt;
-import java.util.Hashtable;
-
import gtPlusPlus.core.material.ELEMENT;
import gtPlusPlus.core.material.ORES;
import gtPlusPlus.core.material.nuclear.FLUORIDES;
+import java.util.Hashtable;
public class WorldGen_Ores {
- public static WorldGen_GT_Ore_Layer BaseVein = new WorldGen_GT_Ore_Layer("veinA", 20, 40, 1, 1, 128,
- ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON,
- ELEMENT.getInstance().IRON);
-
- /**
- * Custom ore Veins
- */
-
- public static WorldGen_GT_Ore_Layer Vein1 = new WorldGen_GT_Ore_Layer("vein1", 0, 60, 30, 2, 16, ORES.AGARDITE_CD,
- ORES.AGARDITE_LA, ORES.DEMICHELEITE_BR, ORES.IRARSITE);
-
- public static WorldGen_GT_Ore_Layer Vein2 = new WorldGen_GT_Ore_Layer("vein2", 0, 60, 30, 2, 16, ORES.AGARDITE_ND,
- ORES.AGARDITE_Y, ORES.KASHINITE, ORES.CERITE);
-
- public static WorldGen_GT_Ore_Layer Vein3 = new WorldGen_GT_Ore_Layer("vein3", 0, 60, 30, 3, 32, ORES.CERITE,
- ORES.NICHROMITE, ORES.XENOTIME, ORES.HIBONITE);
-
- public static WorldGen_GT_Ore_Layer Vein4 = new WorldGen_GT_Ore_Layer("vein4", 0, 60, 40, 3, 32, ORES.GEIKIELITE,
- ORES.CRYOLITE, ORES.GADOLINITE_CE, ORES.AGARDITE_ND);
-
- public static WorldGen_GT_Ore_Layer Vein5 = new WorldGen_GT_Ore_Layer("vein5", 30, 128, 20, 2, 48, ORES.HIBONITE,
- ORES.YTTRIALITE, ORES.ZIRCONILITE, ORES.CERITE);
- public static WorldGen_GT_Ore_Layer Vein6 = new WorldGen_GT_Ore_Layer("vein6", 0, 40, 20, 2, 48, ORES.XENOTIME,
- ORES.ZIRKELITE, ORES.CROCROITE, ORES.IRARSITE);
- public static WorldGen_GT_Ore_Layer Vein7 = new WorldGen_GT_Ore_Layer("vein7", 40, 128, 20, 2, 48, ORES.HONEAITE,
- ORES.MIESSIITE, ORES.SAMARSKITE_Y, ORES.SAMARSKITE_YB);
- public static WorldGen_GT_Ore_Layer Vein8 = new WorldGen_GT_Ore_Layer("vein8", 0, 40, 20, 2, 48, ORES.TITANITE,
- ORES.ZIMBABWEITE, ORES.ZIRCON, ORES.FLORENCITE);
-
- public static WorldGen_GT_Ore_Layer Vein9 = new WorldGen_GT_Ore_Layer("vein9", 10, 30, 20, 1, 48,
- ORES.LANTHANITE_CE, FLUORIDES.FLUORITE, ORES.LAFOSSAITE, ORES.FLORENCITE);
- public static WorldGen_GT_Ore_Layer Vein10 = new WorldGen_GT_Ore_Layer("vein10", 20, 50, 20, 2, 32, ORES.GEIKIELITE,
- ORES.YTTROCERITE, ORES.LANTHANITE_LA, ORES.RADIOBARITE);
- public static WorldGen_GT_Ore_Layer Vein11 = new WorldGen_GT_Ore_Layer("vein11", 30, 70, 20, 1, 48,
- FLUORIDES.FLUORITE, ORES.KASHINITE, ORES.ZIRCON, ORES.CRYOLITE);
- public static WorldGen_GT_Ore_Layer Vein12 = new WorldGen_GT_Ore_Layer("vein12", 40, 80, 20, 3, 32, ORES.CERITE,
- ORES.ALBURNITE, ORES.MIESSIITE, ORES.HIBONITE);
-
- /**
- * Best Rarest Veins 2017
- */
-
- public static WorldGen_GT_Ore_Layer Vein13 = new WorldGen_GT_Ore_Layer("vein13", 5, 15, 5, 1, 16, ORES.CRYOLITE,
- ORES.RADIOBARITE, ORES.HONEAITE, ORES.FLORENCITE);
-
- public static WorldGen_GT_Ore_Layer Vein14 = new WorldGen_GT_Ore_Layer("vein14", 10, 20, 8, 2, 16,
- ORES.DEMICHELEITE_BR, ORES.PERROUDITE, ORES.IRARSITE, ORES.RADIOBARITE);
-
- public static WorldGen_GT_Ore_Layer Vein15 = new WorldGen_GT_Ore_Layer("vein15", 5, 25, 5, 3, 24, ORES.FLUORCAPHITE,
- ORES.LAFOSSAITE, ORES.GADOLINITE_CE, ORES.GADOLINITE_Y);
-
- public static WorldGen_GT_Ore_Layer Vein16 = new WorldGen_GT_Ore_Layer("vein16", 0, 25, 4, 2, 32, ORES.YTTROCERITE,
- ORES.LEPERSONNITE, ORES.LAUTARITE, FLUORIDES.FLUORITE);
-
- public static WorldGen_GT_Ore_Layer Vein17 = new WorldGen_GT_Ore_Layer("vein17", 10, 35, 4, 1, 32, ORES.FLORENCITE,
- ORES.LAUTARITE, ORES.SAMARSKITE_YB, ORES.POLYCRASE);
- public static WorldGen_GT_Ore_Layer Vein18 = new WorldGen_GT_Ore_Layer("vein18", 15, 40, 4, 1, 48,
- ORES.GADOLINITE_CE, ORES.GADOLINITE_Y, ORES.AGARDITE_LA, ORES.AGARDITE_CD);
-
- public static Hashtable<Long, WorldGen_GT_Ore_Layer> validOreveins = new Hashtable<Long, WorldGen_GT_Ore_Layer>(
- 1024);
-
- static long ID = 0;
-
- public static void generateValidOreVeins() {
- validOreveins.put(ID++, BaseVein);
- validOreveins.put(ID++, Vein1);
- validOreveins.put(ID++, Vein2);
- validOreveins.put(ID++, Vein3);
- validOreveins.put(ID++, Vein4);
- validOreveins.put(ID++, Vein5);
- validOreveins.put(ID++, Vein6);
- validOreveins.put(ID++, Vein7);
- validOreveins.put(ID++, Vein8);
- validOreveins.put(ID++, Vein9);
- validOreveins.put(ID++, Vein10);
- validOreveins.put(ID++, Vein11);
- validOreveins.put(ID++, Vein12);
- validOreveins.put(ID++, Vein13);
- validOreveins.put(ID++, Vein14);
- validOreveins.put(ID++, Vein15);
- validOreveins.put(ID++, Vein16);
- validOreveins.put(ID++, Vein17);
- validOreveins.put(ID++, Vein18);
- }
-
+ public static WorldGen_GT_Ore_Layer BaseVein = new WorldGen_GT_Ore_Layer(
+ "veinA",
+ 20,
+ 40,
+ 1,
+ 1,
+ 128,
+ ELEMENT.getInstance().IRON,
+ ELEMENT.getInstance().IRON,
+ ELEMENT.getInstance().IRON,
+ ELEMENT.getInstance().IRON);
+
+ /**
+ * Custom ore Veins
+ */
+ public static WorldGen_GT_Ore_Layer Vein1 = new WorldGen_GT_Ore_Layer(
+ "vein1", 0, 60, 30, 2, 16, ORES.AGARDITE_CD, ORES.AGARDITE_LA, ORES.DEMICHELEITE_BR, ORES.IRARSITE);
+
+ public static WorldGen_GT_Ore_Layer Vein2 = new WorldGen_GT_Ore_Layer(
+ "vein2", 0, 60, 30, 2, 16, ORES.AGARDITE_ND, ORES.AGARDITE_Y, ORES.KASHINITE, ORES.CERITE);
+
+ public static WorldGen_GT_Ore_Layer Vein3 = new WorldGen_GT_Ore_Layer(
+ "vein3", 0, 60, 30, 3, 32, ORES.CERITE, ORES.NICHROMITE, ORES.XENOTIME, ORES.HIBONITE);
+
+ public static WorldGen_GT_Ore_Layer Vein4 = new WorldGen_GT_Ore_Layer(
+ "vein4", 0, 60, 40, 3, 32, ORES.GEIKIELITE, ORES.CRYOLITE, ORES.GADOLINITE_CE, ORES.AGARDITE_ND);
+
+ public static WorldGen_GT_Ore_Layer Vein5 = new WorldGen_GT_Ore_Layer(
+ "vein5", 30, 128, 20, 2, 48, ORES.HIBONITE, ORES.YTTRIALITE, ORES.ZIRCONILITE, ORES.CERITE);
+ public static WorldGen_GT_Ore_Layer Vein6 = new WorldGen_GT_Ore_Layer(
+ "vein6", 0, 40, 20, 2, 48, ORES.XENOTIME, ORES.ZIRKELITE, ORES.CROCROITE, ORES.IRARSITE);
+ public static WorldGen_GT_Ore_Layer Vein7 = new WorldGen_GT_Ore_Layer(
+ "vein7", 40, 128, 20, 2, 48, ORES.HONEAITE, ORES.MIESSIITE, ORES.SAMARSKITE_Y, ORES.SAMARSKITE_YB);
+ public static WorldGen_GT_Ore_Layer Vein8 = new WorldGen_GT_Ore_Layer(
+ "vein8", 0, 40, 20, 2, 48, ORES.TITANITE, ORES.ZIMBABWEITE, ORES.ZIRCON, ORES.FLORENCITE);
+
+ public static WorldGen_GT_Ore_Layer Vein9 = new WorldGen_GT_Ore_Layer(
+ "vein9", 10, 30, 20, 1, 48, ORES.LANTHANITE_CE, FLUORIDES.FLUORITE, ORES.LAFOSSAITE, ORES.FLORENCITE);
+ public static WorldGen_GT_Ore_Layer Vein10 = new WorldGen_GT_Ore_Layer(
+ "vein10", 20, 50, 20, 2, 32, ORES.GEIKIELITE, ORES.YTTROCERITE, ORES.LANTHANITE_LA, ORES.RADIOBARITE);
+ public static WorldGen_GT_Ore_Layer Vein11 = new WorldGen_GT_Ore_Layer(
+ "vein11", 30, 70, 20, 1, 48, FLUORIDES.FLUORITE, ORES.KASHINITE, ORES.ZIRCON, ORES.CRYOLITE);
+ public static WorldGen_GT_Ore_Layer Vein12 = new WorldGen_GT_Ore_Layer(
+ "vein12", 40, 80, 20, 3, 32, ORES.CERITE, ORES.ALBURNITE, ORES.MIESSIITE, ORES.HIBONITE);
+
+ /**
+ * Best Rarest Veins 2017
+ */
+ public static WorldGen_GT_Ore_Layer Vein13 = new WorldGen_GT_Ore_Layer(
+ "vein13", 5, 15, 5, 1, 16, ORES.CRYOLITE, ORES.RADIOBARITE, ORES.HONEAITE, ORES.FLORENCITE);
+
+ public static WorldGen_GT_Ore_Layer Vein14 = new WorldGen_GT_Ore_Layer(
+ "vein14", 10, 20, 8, 2, 16, ORES.DEMICHELEITE_BR, ORES.PERROUDITE, ORES.IRARSITE, ORES.RADIOBARITE);
+
+ public static WorldGen_GT_Ore_Layer Vein15 = new WorldGen_GT_Ore_Layer(
+ "vein15", 5, 25, 5, 3, 24, ORES.FLUORCAPHITE, ORES.LAFOSSAITE, ORES.GADOLINITE_CE, ORES.GADOLINITE_Y);
+
+ public static WorldGen_GT_Ore_Layer Vein16 = new WorldGen_GT_Ore_Layer(
+ "vein16", 0, 25, 4, 2, 32, ORES.YTTROCERITE, ORES.LEPERSONNITE, ORES.LAUTARITE, FLUORIDES.FLUORITE);
+
+ public static WorldGen_GT_Ore_Layer Vein17 = new WorldGen_GT_Ore_Layer(
+ "vein17", 10, 35, 4, 1, 32, ORES.FLORENCITE, ORES.LAUTARITE, ORES.SAMARSKITE_YB, ORES.POLYCRASE);
+ public static WorldGen_GT_Ore_Layer Vein18 = new WorldGen_GT_Ore_Layer(
+ "vein18", 15, 40, 4, 1, 48, ORES.GADOLINITE_CE, ORES.GADOLINITE_Y, ORES.AGARDITE_LA, ORES.AGARDITE_CD);
+
+ public static Hashtable<Long, WorldGen_GT_Ore_Layer> validOreveins =
+ new Hashtable<Long, WorldGen_GT_Ore_Layer>(1024);
+
+ static long ID = 0;
+
+ public static void generateValidOreVeins() {
+ validOreveins.put(ID++, BaseVein);
+ validOreveins.put(ID++, Vein1);
+ validOreveins.put(ID++, Vein2);
+ validOreveins.put(ID++, Vein3);
+ validOreveins.put(ID++, Vein4);
+ validOreveins.put(ID++, Vein5);
+ validOreveins.put(ID++, Vein6);
+ validOreveins.put(ID++, Vein7);
+ validOreveins.put(ID++, Vein8);
+ validOreveins.put(ID++, Vein9);
+ validOreveins.put(ID++, Vein10);
+ validOreveins.put(ID++, Vein11);
+ validOreveins.put(ID++, Vein12);
+ validOreveins.put(ID++, Vein13);
+ validOreveins.put(ID++, Vein14);
+ validOreveins.put(ID++, Vein15);
+ validOreveins.put(ID++, Vein16);
+ validOreveins.put(ID++, Vein17);
+ validOreveins.put(ID++, Vein18);
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/item/ItemBlockToxicEverglades.java b/src/main/java/gtPlusPlus/everglades/item/ItemBlockToxicEverglades.java
index ce4182c598..51776df839 100644
--- a/src/main/java/gtPlusPlus/everglades/item/ItemBlockToxicEverglades.java
+++ b/src/main/java/gtPlusPlus/everglades/item/ItemBlockToxicEverglades.java
@@ -1,42 +1,35 @@
package gtPlusPlus.everglades.item;
+import gtPlusPlus.api.interfaces.ITileTooltip;
import java.util.List;
-
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
-import gtPlusPlus.api.interfaces.ITileTooltip;
-
public class ItemBlockToxicEverglades extends ItemBlock {
-
- protected final int mID;
-
- public ItemBlockToxicEverglades(final Block block) {
- super(block);
- this.mID = ((ITileTooltip) block).getTooltipID();
- }
- @Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- if (this.mID == 0){ //blockDarkWorldPortalFrame
- list.add("Use this to access the Toxic Everglades.");
- list.add("Assembled in the same shape as the Nether Portal.");
- }
- else if (this.mID == 1){ //blockDarkWorldPortal
- list.add("Place this if you are lazy to create the portal structure, slacker.");
- }
- else if (this.mID == 2){ //blockDarkWorldGround
- list.add("Will burn very quickly if it happens to catch fire.");
- }
- else if (this.mID == 3){ //blockDarkWorldPollutedDirt
- list.add("Maybe you can do something with this?.");
- if (stack.getItemDamage() > 0) {
- list.add("This smells worse than a bean fart...");
- }
- }
- }
-
+ protected final int mID;
+
+ public ItemBlockToxicEverglades(final Block block) {
+ super(block);
+ this.mID = ((ITileTooltip) block).getTooltipID();
+ }
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ if (this.mID == 0) { // blockDarkWorldPortalFrame
+ list.add("Use this to access the Toxic Everglades.");
+ list.add("Assembled in the same shape as the Nether Portal.");
+ } else if (this.mID == 1) { // blockDarkWorldPortal
+ list.add("Place this if you are lazy to create the portal structure, slacker.");
+ } else if (this.mID == 2) { // blockDarkWorldGround
+ list.add("Will burn very quickly if it happens to catch fire.");
+ } else if (this.mID == 3) { // blockDarkWorldPollutedDirt
+ list.add("Maybe you can do something with this?.");
+ if (stack.getItemDamage() > 0) {
+ list.add("This smells worse than a bean fart...");
+ }
+ }
+ }
}
diff --git a/src/main/java/gtPlusPlus/everglades/item/ItemEvergladesPortalTrigger.java b/src/main/java/gtPlusPlus/everglades/item/ItemEvergladesPortalTrigger.java
index 3119de19b9..02e0394760 100644
--- a/src/main/java/gtPlusPlus/everglades/item/ItemEvergladesPortalTrigger.java
+++ b/src/main/java/gtPlusPlus/everglades/item/ItemEvergladesPortalTrigger.java
@@ -1,7 +1,10 @@
package gtPlusPlus.everglades.item;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.everglades.dimension.Dimension_Everglades;
import java.util.List;
-
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@@ -12,90 +15,96 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
-import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.everglades.dimension.Dimension_Everglades;
-
public class ItemEvergladesPortalTrigger extends Item {
- public ItemEvergladesPortalTrigger() {
- super();
- this.maxStackSize = 1;
- setMaxDamage(64);
- setCreativeTab(CreativeTabs.tabTools);
- this.setTextureName(CORE.MODID + ":" + "itemAlkalusDisk");
- }
+ public ItemEvergladesPortalTrigger() {
+ super();
+ this.maxStackSize = 1;
+ setMaxDamage(64);
+ setCreativeTab(CreativeTabs.tabTools);
+ this.setTextureName(CORE.MODID + ":" + "itemAlkalusDisk");
+ }
- @Override
- public Item setMaxStackSize(int int1) {
- return super.setMaxStackSize(1);
- }
+ @Override
+ public Item setMaxStackSize(int int1) {
+ return super.setMaxStackSize(1);
+ }
- @Override
- public EnumRarity getRarity(ItemStack thisItem) {
- return EnumRarity.epic;
- }
+ @Override
+ public EnumRarity getRarity(ItemStack thisItem) {
+ return EnumRarity.epic;
+ }
- @Override
- public boolean hasEffect(ItemStack par1ItemStack, int pass) {
- return true;
- }
+ @Override
+ public boolean hasEffect(ItemStack par1ItemStack, int pass) {
+ return true;
+ }
- @Override
- public String getItemStackDisplayName(final ItemStack p_77653_1_) {
- return EnumChatFormatting.GOLD+"Alkalus Disk ["+EnumChatFormatting.RED+"Activated"+EnumChatFormatting.GOLD+"]";
- }
+ @Override
+ public String getItemStackDisplayName(final ItemStack p_77653_1_) {
+ return EnumChatFormatting.GOLD + "Alkalus Disk [" + EnumChatFormatting.RED + "Activated"
+ + EnumChatFormatting.GOLD + "]";
+ }
- @SuppressWarnings({ "unchecked", "rawtypes" })
- @Override
- public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
- list.add(EnumChatFormatting.GREEN+"Shines the way, towards the far away Everglades.");
- list.add(EnumChatFormatting.GREEN+"This item produces such a temperature, that you'd hate to use it incorrectly.");
- super.addInformation(stack, aPlayer, list, bool);
- }
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ @Override
+ public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) {
+ list.add(EnumChatFormatting.GREEN + "Shines the way, towards the far away Everglades.");
+ list.add(EnumChatFormatting.GREEN
+ + "This item produces such a temperature, that you'd hate to use it incorrectly.");
+ super.addInformation(stack, aPlayer, list, bool);
+ }
- @Override
- public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
- return Utils.rgbtoHexValue(255, 128, 0);
- }
+ @Override
+ public int getColorFromItemStack(final ItemStack stack, int HEX_OxFFFFFF) {
+ return Utils.rgbtoHexValue(255, 128, 0);
+ }
- @Override
- public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7,
- float par8, float par9, float par10) {
- if (par7 == 0) {
- par5--;
- }
- if (par7 == 1) {
- par5++;
- }
- if (par7 == 2) {
- par6--;
- }
- if (par7 == 3) {
- par6++;
- }
- if (par7 == 4) {
- par4--;
- }
- if (par7 == 5) {
- par4++;
- }
- if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) {
- return false;
- }
- Block i1 = par3World.getBlock(par4, par5, par6);
- if (i1 == Blocks.air) {
- par3World.playSoundEffect(par4 + 0.5D, par5 + 0.5D, par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
- if (Dimension_Everglades.portalBlock.tryToCreatePortal(par3World, par4, par5, par6)){
- //Make a Portal
- }
- else {
- if (!par3World.isRemote){
- par3World.setBlock(par4, par5, par6, ModBlocks.blockHellfire, 0, 3);
- }
- }
- }
- par1ItemStack.damageItem(1, par2EntityPlayer);
- return true;
- }
-} \ No newline at end of file
+ @Override
+ public boolean onItemUse(
+ ItemStack par1ItemStack,
+ EntityPlayer par2EntityPlayer,
+ World par3World,
+ int par4,
+ int par5,
+ int par6,
+ int par7,
+ float par8,
+ float par9,
+ float par10) {
+ if (par7 == 0) {
+ par5--;
+ }
+ if (par7 == 1) {
+ par5++;
+ }
+ if (par7 == 2) {
+ par6--;
+ }
+ if (par7 == 3) {
+ par6++;
+ }
+ if (par7 == 4) {
+ par4--;
+ }
+ if (par7 == 5) {
+ par4++;
+ }
+ if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) {
+ return false;
+ }
+ Block i1 = par3World.getBlock(par4, par5, par6);
+ if (i1 == Blocks.air) {
+ par3World.playSoundEffect(
+ par4 + 0.5D, par5 + 0.5D, par6 + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
+ if (Dimension_Everglades.portalBlock.tryToCreatePortal(par3World, par4, par5, par6)) {
+ // Make a Portal
+ } else {
+ if (!par3World.isRemote) {
+ par3World.setBlock(par4, par5, par6, ModBlocks.blockHellfire, 0, 3);
+ }
+ }
+ }
+ par1ItemStack.damageItem(1, par2EntityPlayer);
+ return true;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/object/BoxedQuad.java b/src/main/java/gtPlusPlus/everglades/object/BoxedQuad.java
index d0fbc4247b..d407cd6f21 100644
--- a/src/main/java/gtPlusPlus/everglades/object/BoxedQuad.java
+++ b/src/main/java/gtPlusPlus/everglades/object/BoxedQuad.java
@@ -1,56 +1,53 @@
package gtPlusPlus.everglades.object;
-import net.minecraft.block.Block;
-
import gtPlusPlus.api.objects.data.Pair;
+import net.minecraft.block.Block;
-public class BoxedQuad<K,V,C,R> {
-
- private final Pair<Block, Integer> key;
- private final Pair<Block, Integer> value;
- private final Pair<Block, Integer> value2;
- private final Pair<Block, Integer> value3;
- private final Pair<Block, Integer> [] mInternalPairArray;
-
-
- public BoxedQuad(final Pair<Block, Integer> key, final Pair<Block, Integer> value, final Pair<Block, Integer> value2, final Pair<Block, Integer> value3){
- this.key = key;
- this.value = value;
- this.value2 = value2;
- this.value3 = value3;
- mInternalPairArray = new Pair[]{key, value, value2, value3};
- }
-
- final public Pair<Block, Integer> getKey(){
- return this.key;
- }
-
- final public Pair<Block, Integer> getValue_1(){
- return this.value;
- }
-
- final public Pair<Block, Integer> getValue_2(){
- return this.value2;
- }
-
- final public Pair<Block, Integer> getValue_3(){
- return this.value3;
- }
-
- final synchronized Pair<Block, Integer> unbox(int pos){
- return this.mInternalPairArray[pos];
- }
-
- final synchronized Block getBlock(int pos){
- return this.mInternalPairArray[pos].getKey();
- }
-
- final synchronized int getMeta(int pos){
- return this.mInternalPairArray[pos].getValue();
- }
-
-
-
-
-
-} \ No newline at end of file
+public class BoxedQuad<K, V, C, R> {
+
+ private final Pair<Block, Integer> key;
+ private final Pair<Block, Integer> value;
+ private final Pair<Block, Integer> value2;
+ private final Pair<Block, Integer> value3;
+ private final Pair<Block, Integer>[] mInternalPairArray;
+
+ public BoxedQuad(
+ final Pair<Block, Integer> key,
+ final Pair<Block, Integer> value,
+ final Pair<Block, Integer> value2,
+ final Pair<Block, Integer> value3) {
+ this.key = key;
+ this.value = value;
+ this.value2 = value2;
+ this.value3 = value3;
+ mInternalPairArray = new Pair[] {key, value, value2, value3};
+ }
+
+ public final Pair<Block, Integer> getKey() {
+ return this.key;
+ }
+
+ public final Pair<Block, Integer> getValue_1() {
+ return this.value;
+ }
+
+ public final Pair<Block, Integer> getValue_2() {
+ return this.value2;
+ }
+
+ public final Pair<Block, Integer> getValue_3() {
+ return this.value3;
+ }
+
+ final synchronized Pair<Block, Integer> unbox(int pos) {
+ return this.mInternalPairArray[pos];
+ }
+
+ final synchronized Block getBlock(int pos) {
+ return this.mInternalPairArray[pos].getKey();
+ }
+
+ final synchronized int getMeta(int pos) {
+ return this.mInternalPairArray[pos].getValue();
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/world/CustomWorldType.java b/src/main/java/gtPlusPlus/everglades/world/CustomWorldType.java
index 5a5344ca65..95ea14858e 100644
--- a/src/main/java/gtPlusPlus/everglades/world/CustomWorldType.java
+++ b/src/main/java/gtPlusPlus/everglades/world/CustomWorldType.java
@@ -3,57 +3,54 @@ package gtPlusPlus.everglades.world;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-
import net.minecraft.world.WorldType;
-public class CustomWorldType extends WorldType{
-
- public CustomWorldType(String name) {
- super(name);
- }
-
- public CustomWorldType(int p_i1959_1_, String p_i1959_2_){
- this("test");
- try {
- //System.out.println(Arrays.toString(getClass().getSuperclass().getMethods()));
- Method m = getClass().getSuperclass().getDeclaredMethod("WorldType", new Class<?>[]{});
- m.setAccessible(true);
- m.invoke(this, p_i1959_1_, p_i1959_2_, 0);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public CustomWorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_){
- this("test2");
- try {
- //System.out.println(Arrays.toString(getClass().getSuperclass().getMethods()));
- Method m = getClass().getSuperclass().getDeclaredMethod("WorldType", new Class<?>[]{});
- m.setAccessible(true);
- m.invoke(this, p_i1960_1_, p_i1960_2_, p_i1960_3_);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- private WorldType getMC(){
- try {
- Constructor<WorldType> c = WorldType.class.getDeclaredConstructor();
- c.setAccessible(true); // solution
- return c.newInstance();
-
- // production code should handle these exceptions more gracefully
- } catch (InvocationTargetException x) {
- x.printStackTrace();
- } catch (NoSuchMethodException x) {
- x.printStackTrace();
- } catch (InstantiationException x) {
- x.printStackTrace();
- } catch (IllegalAccessException x) {
- x.printStackTrace();
- }
- return null;
- }
+public class CustomWorldType extends WorldType {
+
+ public CustomWorldType(String name) {
+ super(name);
+ }
+
+ public CustomWorldType(int p_i1959_1_, String p_i1959_2_) {
+ this("test");
+ try {
+ // System.out.println(Arrays.toString(getClass().getSuperclass().getMethods()));
+ Method m = getClass().getSuperclass().getDeclaredMethod("WorldType", new Class<?>[] {});
+ m.setAccessible(true);
+ m.invoke(this, p_i1959_1_, p_i1959_2_, 0);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public CustomWorldType(int p_i1960_1_, String p_i1960_2_, int p_i1960_3_) {
+ this("test2");
+ try {
+ // System.out.println(Arrays.toString(getClass().getSuperclass().getMethods()));
+ Method m = getClass().getSuperclass().getDeclaredMethod("WorldType", new Class<?>[] {});
+ m.setAccessible(true);
+ m.invoke(this, p_i1960_1_, p_i1960_2_, p_i1960_3_);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private WorldType getMC() {
+ try {
+ Constructor<WorldType> c = WorldType.class.getDeclaredConstructor();
+ c.setAccessible(true); // solution
+ return c.newInstance();
+
+ // production code should handle these exceptions more gracefully
+ } catch (InvocationTargetException x) {
+ x.printStackTrace();
+ } catch (NoSuchMethodException x) {
+ x.printStackTrace();
+ } catch (InstantiationException x) {
+ x.printStackTrace();
+ } catch (IllegalAccessException x) {
+ x.printStackTrace();
+ }
+ return null;
+ }
}
-
diff --git a/src/main/java/gtPlusPlus/everglades/world/EvergladesPortalPosition.java b/src/main/java/gtPlusPlus/everglades/world/EvergladesPortalPosition.java
index 227d32502b..bfeb8c94ad 100644
--- a/src/main/java/gtPlusPlus/everglades/world/EvergladesPortalPosition.java
+++ b/src/main/java/gtPlusPlus/everglades/world/EvergladesPortalPosition.java
@@ -3,12 +3,12 @@ package gtPlusPlus.everglades.world;
import net.minecraft.util.ChunkCoordinates;
public class EvergladesPortalPosition extends ChunkCoordinates {
- public long field_85087_d;
- final TeleporterDimensionMod field_85088_e;
+ public long field_85087_d;
+ final TeleporterDimensionMod field_85088_e;
- public EvergladesPortalPosition(TeleporterDimensionMod gladesTeleporter, int par2, int par3, int par4, long par5) {
- super(par2, par3, par4);
- this.field_85088_e = gladesTeleporter;
- this.field_85087_d = par5;
- }
-} \ No newline at end of file
+ public EvergladesPortalPosition(TeleporterDimensionMod gladesTeleporter, int par2, int par3, int par4, long par5) {
+ super(par2, par3, par4);
+ this.field_85088_e = gladesTeleporter;
+ this.field_85087_d = par5;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/world/TeleporterDimensionMod.java b/src/main/java/gtPlusPlus/everglades/world/TeleporterDimensionMod.java
index e67a882638..ee8488ab75 100644
--- a/src/main/java/gtPlusPlus/everglades/world/TeleporterDimensionMod.java
+++ b/src/main/java/gtPlusPlus/everglades/world/TeleporterDimensionMod.java
@@ -1,7 +1,7 @@
package gtPlusPlus.everglades.world;
+import gtPlusPlus.everglades.dimension.Dimension_Everglades;
import java.util.*;
-
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.*;
@@ -9,463 +9,463 @@ import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.Teleporter;
import net.minecraft.world.WorldServer;
-import gtPlusPlus.everglades.dimension.Dimension_Everglades;
-
public class TeleporterDimensionMod extends Teleporter {
- private final WorldServer worldServerInstance;
- /**
- * A private Random() function in Teleporter
- */
- private final Random random;
- /**
- * Stores successful portal placement locations for rapid lookup.
- */
- private final LongHashMap destinationCoordinateCache = new LongHashMap();
- /**
- * A list of valid keys for the destinationCoordainteCache. These are
- * based on the X & Z of the players initial location.
- */
- @SuppressWarnings("rawtypes")
- private final List destinationCoordinateKeys = new ArrayList();
-
- public TeleporterDimensionMod(WorldServer par1WorldServer) {
- super(par1WorldServer);
- this.worldServerInstance = par1WorldServer;
- this.random = new Random(par1WorldServer.getSeed());
- }
-
- /**
- * Place an entity in a nearby portal, creating one if necessary.
- */
- @Override
- public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) {
- if (this.worldServerInstance.provider.dimensionId != 1) {
- if (!this.placeInExistingPortal(par1Entity, par2, par4, par6, par8)) {
- this.makePortal(par1Entity);
- this.placeInExistingPortal(par1Entity, par2, par4, par6, par8);
- }
- }
- else {
- int i = MathHelper.floor_double(par1Entity.posX);
- int j = MathHelper.floor_double(par1Entity.posY) - 1;
- int k = MathHelper.floor_double(par1Entity.posZ);
- byte b0 = 1;
- byte b1 = 0;
-
- for (int l = -2; l <= 2; ++l) {
- for (int i1 = -2; i1 <= 2; ++i1) {
- for (int j1 = -1; j1 < 3; ++j1) {
- int k1 = i + i1 * b0 + l * b1;
- int l1 = j + j1;
- int i2 = k + i1 * b1 - l * b0;
- boolean flag = j1 < 0;
- this.worldServerInstance.setBlock(k1, l1, i2, flag ? Dimension_Everglades.blockPortalFrame : Blocks.air);
- }
- }
- }
-
- par1Entity.setLocationAndAngles(i, j, k, par1Entity.rotationYaw, 0.0F);
- par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
- }
- }
-
- /**
- * Place an entity in a nearby portal which already exists.
- */
- @Override
- public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8) {
- short short1 = 128;
- double d3 = -1.0D;
- int i = 0;
- int j = 0;
- int k = 0;
- int l = MathHelper.floor_double(par1Entity.posX);
- int i1 = MathHelper.floor_double(par1Entity.posZ);
- long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1);
- boolean flag = true;
- double d7;
- int l3;
-
- if (this.destinationCoordinateCache.containsItem(j1)) {
- Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache
- .getValueByKey(j1);
- d3 = 0.0D;
- i = portalposition.posX;
- j = portalposition.posY;
- k = portalposition.posZ;
- portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
- flag = false;
- }
- else {
- for (l3 = l - short1; l3 <= l + short1; ++l3) {
- double d4 = l3 + 0.5D - par1Entity.posX;
-
- for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) {
- double d5 = l1 + 0.5D - par1Entity.posZ;
-
- for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) {
- if (this.worldServerInstance.getBlock(l3, i2, l1) == Dimension_Everglades.portalBlock) {
- while (this.worldServerInstance.getBlock(l3, i2 - 1, l1) == Dimension_Everglades.portalBlock) {
- --i2;
- }
-
- d7 = i2 + 0.5D - par1Entity.posY;
- double d8 = d4 * d4 + d7 * d7 + d5 * d5;
-
- if (d3 < 0.0D || d8 < d3) {
- d3 = d8;
- i = l3;
- j = i2;
- k = l1;
- }
- }
- }
- }
- }
- }
-
- if (d3 >= 0.0D) {
- if (flag) {
- this.destinationCoordinateCache.add(j1,
- new Teleporter.PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime()));
- this.destinationCoordinateKeys.add(Long.valueOf(j1));
- }
-
- double d11 = i + 0.5D;
- double d6 = j + 0.5D;
- d7 = k + 0.5D;
- int i4 = -1;
-
- if (this.worldServerInstance.getBlock(i - 1, j, k) == Dimension_Everglades.portalBlock) {
- i4 = 2;
- }
-
- if (this.worldServerInstance.getBlock(i + 1, j, k) == Dimension_Everglades.portalBlock) {
- i4 = 0;
- }
-
- if (this.worldServerInstance.getBlock(i, j, k - 1) == Dimension_Everglades.portalBlock) {
- i4 = 3;
- }
-
- if (this.worldServerInstance.getBlock(i, j, k + 1) == Dimension_Everglades.portalBlock) {
- i4 = 1;
- }
-
- int j2 = par1Entity.getTeleportDirection();
-
- if (i4 > -1) {
- int k2 = Direction.rotateLeft[i4];
- int l2 = Direction.offsetX[i4];
- int i3 = Direction.offsetZ[i4];
- int j3 = Direction.offsetX[k2];
- int k3 = Direction.offsetZ[k2];
- boolean flag1 = !this.worldServerInstance.isAirBlock(i + l2 + j3, j, k + i3 + k3)
- || !this.worldServerInstance.isAirBlock(i + l2 + j3, j + 1, k + i3 + k3);
- boolean flag2 = !this.worldServerInstance.isAirBlock(i + l2, j, k + i3)
- || !this.worldServerInstance.isAirBlock(i + l2, j + 1, k + i3);
-
- if (flag1 && flag2) {
- i4 = Direction.rotateOpposite[i4];
- k2 = Direction.rotateOpposite[k2];
- l2 = Direction.offsetX[i4];
- i3 = Direction.offsetZ[i4];
- j3 = Direction.offsetX[k2];
- k3 = Direction.offsetZ[k2];
- l3 = i - j3;
- d11 -= j3;
- int k1 = k - k3;
- d7 -= k3;
- flag1 = !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j, k1 + i3 + k3)
- || !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j + 1, k1 + i3 + k3);
- flag2 = !this.worldServerInstance.isAirBlock(l3 + l2, j, k1 + i3)
- || !this.worldServerInstance.isAirBlock(l3 + l2, j + 1, k1 + i3);
- }
-
- float f1 = 0.5F;
- float f2 = 0.5F;
-
- if (!flag1 && flag2) {
- f1 = 1.0F;
- }
- else if (flag1 && !flag2) {
- f1 = 0.0F;
- }
- else if (flag1 && flag2) {
- f2 = 0.0F;
- }
-
- d11 += j3 * f1 + f2 * l2;
- d7 += k3 * f1 + f2 * i3;
- float f3 = 0.0F;
- float f4 = 0.0F;
- float f5 = 0.0F;
- float f6 = 0.0F;
-
- if (i4 == j2) {
- f3 = 1.0F;
- f4 = 1.0F;
- }
- else if (i4 == Direction.rotateOpposite[j2]) {
- f3 = -1.0F;
- f4 = -1.0F;
- }
- else if (i4 == Direction.rotateRight[j2]) {
- f5 = 1.0F;
- f6 = -1.0F;
- }
- else {
- f5 = -1.0F;
- f6 = 1.0F;
- }
-
- double d9 = par1Entity.motionX;
- double d10 = par1Entity.motionZ;
- par1Entity.motionX = d9 * f3 + d10 * f6;
- par1Entity.motionZ = d9 * f5 + d10 * f4;
- par1Entity.rotationYaw = par8 - j2 * 90 + i4 * 90;
- }
- else {
- par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
- }
-
- par1Entity.setLocationAndAngles(d11, d6, d7, par1Entity.rotationYaw, par1Entity.rotationPitch);
- return true;
- }
- else {
- return false;
- }
- }
-
- @Override
- public boolean makePortal(Entity par1Entity) {
- byte b0 = 16;
- double d0 = -1.0D;
- int i = MathHelper.floor_double(par1Entity.posX);
- int j = MathHelper.floor_double(par1Entity.posY);
- int k = MathHelper.floor_double(par1Entity.posZ);
- int l = i;
- int i1 = j;
- int j1 = k;
- int k1 = 0;
- int l1 = this.random.nextInt(4);
- int i2;
- double d1;
- double d2;
- int k2;
- int i3;
- int k3;
- int j3;
- int i4;
- int l3;
- int k4;
- int j4;
- int i5;
- int l4;
- double d3;
- double d4;
-
- for (i2 = i - b0; i2 <= i + b0; ++i2) {
- d1 = i2 + 0.5D - par1Entity.posX;
-
- for (k2 = k - b0; k2 <= k + b0; ++k2) {
- d2 = k2 + 0.5D - par1Entity.posZ;
- label274:
-
- for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) {
- if (this.worldServerInstance.isAirBlock(i2, i3, k2)) {
- while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) {
- --i3;
- }
-
- for (j3 = l1; j3 < l1 + 4; ++j3) {
- k3 = j3 % 2;
- l3 = 1 - k3;
-
- if (j3 % 4 >= 2) {
- k3 = -k3;
- l3 = -l3;
- }
-
- for (i4 = 0; i4 < 3; ++i4) {
- for (j4 = 0; j4 < 4; ++j4) {
- for (k4 = -1; k4 < 4; ++k4) {
- l4 = i2 + (j4 - 1) * k3 + i4 * l3;
- i5 = i3 + k4;
- int j5 = k2 + (j4 - 1) * l3 - i4 * k3;
-
- if (k4 < 0
- && !this.worldServerInstance.getBlock(l4, i5, j5).getMaterial()
- .isSolid()
- || k4 >= 0 && !this.worldServerInstance.isAirBlock(l4, i5, j5)) {
- continue label274;
- }
- }
- }
- }
-
- d4 = i3 + 0.5D - par1Entity.posY;
- d3 = d1 * d1 + d4 * d4 + d2 * d2;
-
- if (d0 < 0.0D || d3 < d0) {
- d0 = d3;
- l = i2;
- i1 = i3;
- j1 = k2;
- k1 = j3 % 4;
- }
- }
- }
- }
- }
- }
-
- if (d0 < 0.0D) {
- for (i2 = i - b0; i2 <= i + b0; ++i2) {
- d1 = i2 + 0.5D - par1Entity.posX;
-
- for (k2 = k - b0; k2 <= k + b0; ++k2) {
- d2 = k2 + 0.5D - par1Entity.posZ;
- label222:
-
- for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) {
- if (this.worldServerInstance.isAirBlock(i2, i3, k2)) {
- while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) {
- --i3;
- }
-
- for (j3 = l1; j3 < l1 + 2; ++j3) {
- k3 = j3 % 2;
- l3 = 1 - k3;
-
- for (i4 = 0; i4 < 4; ++i4) {
- for (j4 = -1; j4 < 4; ++j4) {
- k4 = i2 + (i4 - 1) * k3;
- l4 = i3 + j4;
- i5 = k2 + (i4 - 1) * l3;
-
- if (j4 < 0
- && !this.worldServerInstance.getBlock(k4, l4, i5).getMaterial()
- .isSolid()
- || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, l4, i5)) {
- continue label222;
- }
- }
- }
-
- d4 = i3 + 0.5D - par1Entity.posY;
- d3 = d1 * d1 + d4 * d4 + d2 * d2;
-
- if (d0 < 0.0D || d3 < d0) {
- d0 = d3;
- l = i2;
- i1 = i3;
- j1 = k2;
- k1 = j3 % 2;
- }
- }
- }
- }
- }
- }
- }
-
- int k5 = l;
- int j2 = i1;
- k2 = j1;
- int l5 = k1 % 2;
- int l2 = 1 - l5;
-
- if (k1 % 4 >= 2) {
- l5 = -l5;
- l2 = -l2;
- }
-
- boolean flag;
-
- if (d0 < 0.0D) {
- if (i1 < 70) {
- i1 = 70;
- }
-
- if (i1 > this.worldServerInstance.getActualHeight() - 10) {
- i1 = this.worldServerInstance.getActualHeight() - 10;
- }
-
- j2 = i1;
-
- for (i3 = -1; i3 <= 1; ++i3) {
- for (j3 = 1; j3 < 3; ++j3) {
- for (k3 = -1; k3 < 3; ++k3) {
- l3 = k5 + (j3 - 1) * l5 + i3 * l2;
- i4 = j2 + k3;
- j4 = k2 + (j3 - 1) * l2 - i3 * l5;
- flag = k3 < 0;
- this.worldServerInstance.setBlock(l3, i4, j4, flag ? Dimension_Everglades.blockPortalFrame : Blocks.air);
- }
- }
- }
- }
-
- for (i3 = 0; i3 < 4; ++i3) {
- for (j3 = 0; j3 < 4; ++j3) {
- for (k3 = -1; k3 < 4; ++k3) {
- l3 = k5 + (j3 - 1) * l5;
- i4 = j2 + k3;
- j4 = k2 + (j3 - 1) * l2;
- flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3;
- this.worldServerInstance.setBlock(l3, i4, j4, flag ? Dimension_Everglades.blockPortalFrame : Dimension_Everglades.portalBlock, 0, 2);
- }
- }
-
- for (j3 = 0; j3 < 4; ++j3) {
- for (k3 = -1; k3 < 4; ++k3) {
- l3 = k5 + (j3 - 1) * l5;
- i4 = j2 + k3;
- j4 = k2 + (j3 - 1) * l2;
- this.worldServerInstance.notifyBlocksOfNeighborChange(l3, i4, j4,
- this.worldServerInstance.getBlock(l3, i4, j4));
- }
- }
- }
-
- return true;
- }
-
- /**
- * called periodically to remove out-of-date portal locations from the
- * cache list. Argument par1 is a WorldServer.getTotalWorldTime() value.
- */
- @Override
- public void removeStalePortalLocations(long par1) {
- if (par1 % 100L == 0L) {
- @SuppressWarnings("rawtypes")
- Iterator iterator = this.destinationCoordinateKeys.iterator();
- long j = par1 - 600L;
-
- while (iterator.hasNext()) {
- Long olong = (Long) iterator.next();
- Teleporter.PortalPosition portalposition = (Teleporter.PortalPosition) this.destinationCoordinateCache
- .getValueByKey(olong.longValue());
-
- if (portalposition == null || portalposition.lastUpdateTime < j) {
- iterator.remove();
- this.destinationCoordinateCache.remove(olong.longValue());
- }
- }
- }
- }
-
- public class PortalPosition extends ChunkCoordinates {
- /**
- * The worldtime at which this PortalPosition was last verified
- */
- public long lastUpdateTime;
-
- public PortalPosition(int par2, int par3, int par4, long par5) {
- super(par2, par3, par4);
- this.lastUpdateTime = par5;
- }
- }
-} \ No newline at end of file
+ private final WorldServer worldServerInstance;
+ /**
+ * A private Random() function in Teleporter
+ */
+ private final Random random;
+ /**
+ * Stores successful portal placement locations for rapid lookup.
+ */
+ private final LongHashMap destinationCoordinateCache = new LongHashMap();
+ /**
+ * A list of valid keys for the destinationCoordainteCache. These are
+ * based on the X & Z of the players initial location.
+ */
+ @SuppressWarnings("rawtypes")
+ private final List destinationCoordinateKeys = new ArrayList();
+
+ public TeleporterDimensionMod(WorldServer par1WorldServer) {
+ super(par1WorldServer);
+ this.worldServerInstance = par1WorldServer;
+ this.random = new Random(par1WorldServer.getSeed());
+ }
+
+ /**
+ * Place an entity in a nearby portal, creating one if necessary.
+ */
+ @Override
+ public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8) {
+ if (this.worldServerInstance.provider.dimensionId != 1) {
+ if (!this.placeInExistingPortal(par1Entity, par2, par4, par6, par8)) {
+ this.makePortal(par1Entity);
+ this.placeInExistingPortal(par1Entity, par2, par4, par6, par8);
+ }
+ } else {
+ int i = MathHelper.floor_double(par1Entity.posX);
+ int j = MathHelper.floor_double(par1Entity.posY) - 1;
+ int k = MathHelper.floor_double(par1Entity.posZ);
+ byte b0 = 1;
+ byte b1 = 0;
+
+ for (int l = -2; l <= 2; ++l) {
+ for (int i1 = -2; i1 <= 2; ++i1) {
+ for (int j1 = -1; j1 < 3; ++j1) {
+ int k1 = i + i1 * b0 + l * b1;
+ int l1 = j + j1;
+ int i2 = k + i1 * b1 - l * b0;
+ boolean flag = j1 < 0;
+ this.worldServerInstance.setBlock(
+ k1, l1, i2, flag ? Dimension_Everglades.blockPortalFrame : Blocks.air);
+ }
+ }
+ }
+
+ par1Entity.setLocationAndAngles(i, j, k, par1Entity.rotationYaw, 0.0F);
+ par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
+ }
+ }
+
+ /**
+ * Place an entity in a nearby portal which already exists.
+ */
+ @Override
+ public boolean placeInExistingPortal(Entity par1Entity, double par2, double par4, double par6, float par8) {
+ short short1 = 128;
+ double d3 = -1.0D;
+ int i = 0;
+ int j = 0;
+ int k = 0;
+ int l = MathHelper.floor_double(par1Entity.posX);
+ int i1 = MathHelper.floor_double(par1Entity.posZ);
+ long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1);
+ boolean flag = true;
+ double d7;
+ int l3;
+
+ if (this.destinationCoordinateCache.containsItem(j1)) {
+ Teleporter.PortalPosition portalposition =
+ (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(j1);
+ d3 = 0.0D;
+ i = portalposition.posX;
+ j = portalposition.posY;
+ k = portalposition.posZ;
+ portalposition.lastUpdateTime = this.worldServerInstance.getTotalWorldTime();
+ flag = false;
+ } else {
+ for (l3 = l - short1; l3 <= l + short1; ++l3) {
+ double d4 = l3 + 0.5D - par1Entity.posX;
+
+ for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) {
+ double d5 = l1 + 0.5D - par1Entity.posZ;
+
+ for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) {
+ if (this.worldServerInstance.getBlock(l3, i2, l1) == Dimension_Everglades.portalBlock) {
+ while (this.worldServerInstance.getBlock(l3, i2 - 1, l1)
+ == Dimension_Everglades.portalBlock) {
+ --i2;
+ }
+
+ d7 = i2 + 0.5D - par1Entity.posY;
+ double d8 = d4 * d4 + d7 * d7 + d5 * d5;
+
+ if (d3 < 0.0D || d8 < d3) {
+ d3 = d8;
+ i = l3;
+ j = i2;
+ k = l1;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (d3 >= 0.0D) {
+ if (flag) {
+ this.destinationCoordinateCache.add(
+ j1, new Teleporter.PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime()));
+ this.destinationCoordinateKeys.add(Long.valueOf(j1));
+ }
+
+ double d11 = i + 0.5D;
+ double d6 = j + 0.5D;
+ d7 = k + 0.5D;
+ int i4 = -1;
+
+ if (this.worldServerInstance.getBlock(i - 1, j, k) == Dimension_Everglades.portalBlock) {
+ i4 = 2;
+ }
+
+ if (this.worldServerInstance.getBlock(i + 1, j, k) == Dimension_Everglades.portalBlock) {
+ i4 = 0;
+ }
+
+ if (this.worldServerInstance.getBlock(i, j, k - 1) == Dimension_Everglades.portalBlock) {
+ i4 = 3;
+ }
+
+ if (this.worldServerInstance.getBlock(i, j, k + 1) == Dimension_Everglades.portalBlock) {
+ i4 = 1;
+ }
+
+ int j2 = par1Entity.getTeleportDirection();
+
+ if (i4 > -1) {
+ int k2 = Direction.rotateLeft[i4];
+ int l2 = Direction.offsetX[i4];
+ int i3 = Direction.offsetZ[i4];
+ int j3 = Direction.offsetX[k2];
+ int k3 = Direction.offsetZ[k2];
+ boolean flag1 = !this.worldServerInstance.isAirBlock(i + l2 + j3, j, k + i3 + k3)
+ || !this.worldServerInstance.isAirBlock(i + l2 + j3, j + 1, k + i3 + k3);
+ boolean flag2 = !this.worldServerInstance.isAirBlock(i + l2, j, k + i3)
+ || !this.worldServerInstance.isAirBlock(i + l2, j + 1, k + i3);
+
+ if (flag1 && flag2) {
+ i4 = Direction.rotateOpposite[i4];
+ k2 = Direction.rotateOpposite[k2];
+ l2 = Direction.offsetX[i4];
+ i3 = Direction.offsetZ[i4];
+ j3 = Direction.offsetX[k2];
+ k3 = Direction.offsetZ[k2];
+ l3 = i - j3;
+ d11 -= j3;
+ int k1 = k - k3;
+ d7 -= k3;
+ flag1 = !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j, k1 + i3 + k3)
+ || !this.worldServerInstance.isAirBlock(l3 + l2 + j3, j + 1, k1 + i3 + k3);
+ flag2 = !this.worldServerInstance.isAirBlock(l3 + l2, j, k1 + i3)
+ || !this.worldServerInstance.isAirBlock(l3 + l2, j + 1, k1 + i3);
+ }
+
+ float f1 = 0.5F;
+ float f2 = 0.5F;
+
+ if (!flag1 && flag2) {
+ f1 = 1.0F;
+ } else if (flag1 && !flag2) {
+ f1 = 0.0F;
+ } else if (flag1 && flag2) {
+ f2 = 0.0F;
+ }
+
+ d11 += j3 * f1 + f2 * l2;
+ d7 += k3 * f1 + f2 * i3;
+ float f3 = 0.0F;
+ float f4 = 0.0F;
+ float f5 = 0.0F;
+ float f6 = 0.0F;
+
+ if (i4 == j2) {
+ f3 = 1.0F;
+ f4 = 1.0F;
+ } else if (i4 == Direction.rotateOpposite[j2]) {
+ f3 = -1.0F;
+ f4 = -1.0F;
+ } else if (i4 == Direction.rotateRight[j2]) {
+ f5 = 1.0F;
+ f6 = -1.0F;
+ } else {
+ f5 = -1.0F;
+ f6 = 1.0F;
+ }
+
+ double d9 = par1Entity.motionX;
+ double d10 = par1Entity.motionZ;
+ par1Entity.motionX = d9 * f3 + d10 * f6;
+ par1Entity.motionZ = d9 * f5 + d10 * f4;
+ par1Entity.rotationYaw = par8 - j2 * 90 + i4 * 90;
+ } else {
+ par1Entity.motionX = par1Entity.motionY = par1Entity.motionZ = 0.0D;
+ }
+
+ par1Entity.setLocationAndAngles(d11, d6, d7, par1Entity.rotationYaw, par1Entity.rotationPitch);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public boolean makePortal(Entity par1Entity) {
+ byte b0 = 16;
+ double d0 = -1.0D;
+ int i = MathHelper.floor_double(par1Entity.posX);
+ int j = MathHelper.floor_double(par1Entity.posY);
+ int k = MathHelper.floor_double(par1Entity.posZ);
+ int l = i;
+ int i1 = j;
+ int j1 = k;
+ int k1 = 0;
+ int l1 = this.random.nextInt(4);
+ int i2;
+ double d1;
+ double d2;
+ int k2;
+ int i3;
+ int k3;
+ int j3;
+ int i4;
+ int l3;
+ int k4;
+ int j4;
+ int i5;
+ int l4;
+ double d3;
+ double d4;
+
+ for (i2 = i - b0; i2 <= i + b0; ++i2) {
+ d1 = i2 + 0.5D - par1Entity.posX;
+
+ for (k2 = k - b0; k2 <= k + b0; ++k2) {
+ d2 = k2 + 0.5D - par1Entity.posZ;
+ label274:
+ for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) {
+ if (this.worldServerInstance.isAirBlock(i2, i3, k2)) {
+ while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) {
+ --i3;
+ }
+
+ for (j3 = l1; j3 < l1 + 4; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ if (j3 % 4 >= 2) {
+ k3 = -k3;
+ l3 = -l3;
+ }
+
+ for (i4 = 0; i4 < 3; ++i4) {
+ for (j4 = 0; j4 < 4; ++j4) {
+ for (k4 = -1; k4 < 4; ++k4) {
+ l4 = i2 + (j4 - 1) * k3 + i4 * l3;
+ i5 = i3 + k4;
+ int j5 = k2 + (j4 - 1) * l3 - i4 * k3;
+
+ if (k4 < 0
+ && !this.worldServerInstance
+ .getBlock(l4, i5, j5)
+ .getMaterial()
+ .isSolid()
+ || k4 >= 0 && !this.worldServerInstance.isAirBlock(l4, i5, j5)) {
+ continue label274;
+ }
+ }
+ }
+ }
+
+ d4 = i3 + 0.5D - par1Entity.posY;
+ d3 = d1 * d1 + d4 * d4 + d2 * d2;
+
+ if (d0 < 0.0D || d3 < d0) {
+ d0 = d3;
+ l = i2;
+ i1 = i3;
+ j1 = k2;
+ k1 = j3 % 4;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (d0 < 0.0D) {
+ for (i2 = i - b0; i2 <= i + b0; ++i2) {
+ d1 = i2 + 0.5D - par1Entity.posX;
+
+ for (k2 = k - b0; k2 <= k + b0; ++k2) {
+ d2 = k2 + 0.5D - par1Entity.posZ;
+ label222:
+ for (i3 = this.worldServerInstance.getActualHeight() - 1; i3 >= 0; --i3) {
+ if (this.worldServerInstance.isAirBlock(i2, i3, k2)) {
+ while (i3 > 0 && this.worldServerInstance.isAirBlock(i2, i3 - 1, k2)) {
+ --i3;
+ }
+
+ for (j3 = l1; j3 < l1 + 2; ++j3) {
+ k3 = j3 % 2;
+ l3 = 1 - k3;
+
+ for (i4 = 0; i4 < 4; ++i4) {
+ for (j4 = -1; j4 < 4; ++j4) {
+ k4 = i2 + (i4 - 1) * k3;
+ l4 = i3 + j4;
+ i5 = k2 + (i4 - 1) * l3;
+
+ if (j4 < 0
+ && !this.worldServerInstance
+ .getBlock(k4, l4, i5)
+ .getMaterial()
+ .isSolid()
+ || j4 >= 0 && !this.worldServerInstance.isAirBlock(k4, l4, i5)) {
+ continue label222;
+ }
+ }
+ }
+
+ d4 = i3 + 0.5D - par1Entity.posY;
+ d3 = d1 * d1 + d4 * d4 + d2 * d2;
+
+ if (d0 < 0.0D || d3 < d0) {
+ d0 = d3;
+ l = i2;
+ i1 = i3;
+ j1 = k2;
+ k1 = j3 % 2;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ int k5 = l;
+ int j2 = i1;
+ k2 = j1;
+ int l5 = k1 % 2;
+ int l2 = 1 - l5;
+
+ if (k1 % 4 >= 2) {
+ l5 = -l5;
+ l2 = -l2;
+ }
+
+ boolean flag;
+
+ if (d0 < 0.0D) {
+ if (i1 < 70) {
+ i1 = 70;
+ }
+
+ if (i1 > this.worldServerInstance.getActualHeight() - 10) {
+ i1 = this.worldServerInstance.getActualHeight() - 10;
+ }
+
+ j2 = i1;
+
+ for (i3 = -1; i3 <= 1; ++i3) {
+ for (j3 = 1; j3 < 3; ++j3) {
+ for (k3 = -1; k3 < 3; ++k3) {
+ l3 = k5 + (j3 - 1) * l5 + i3 * l2;
+ i4 = j2 + k3;
+ j4 = k2 + (j3 - 1) * l2 - i3 * l5;
+ flag = k3 < 0;
+ this.worldServerInstance.setBlock(
+ l3, i4, j4, flag ? Dimension_Everglades.blockPortalFrame : Blocks.air);
+ }
+ }
+ }
+ }
+
+ for (i3 = 0; i3 < 4; ++i3) {
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ i4 = j2 + k3;
+ j4 = k2 + (j3 - 1) * l2;
+ flag = j3 == 0 || j3 == 3 || k3 == -1 || k3 == 3;
+ this.worldServerInstance.setBlock(
+ l3,
+ i4,
+ j4,
+ flag ? Dimension_Everglades.blockPortalFrame : Dimension_Everglades.portalBlock,
+ 0,
+ 2);
+ }
+ }
+
+ for (j3 = 0; j3 < 4; ++j3) {
+ for (k3 = -1; k3 < 4; ++k3) {
+ l3 = k5 + (j3 - 1) * l5;
+ i4 = j2 + k3;
+ j4 = k2 + (j3 - 1) * l2;
+ this.worldServerInstance.notifyBlocksOfNeighborChange(
+ l3, i4, j4, this.worldServerInstance.getBlock(l3, i4, j4));
+ }
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * called periodically to remove out-of-date portal locations from the
+ * cache list. Argument par1 is a WorldServer.getTotalWorldTime() value.
+ */
+ @Override
+ public void removeStalePortalLocations(long par1) {
+ if (par1 % 100L == 0L) {
+ @SuppressWarnings("rawtypes")
+ Iterator iterator = this.destinationCoordinateKeys.iterator();
+ long j = par1 - 600L;
+
+ while (iterator.hasNext()) {
+ Long olong = (Long) iterator.next();
+ Teleporter.PortalPosition portalposition =
+ (Teleporter.PortalPosition) this.destinationCoordinateCache.getValueByKey(olong.longValue());
+
+ if (portalposition == null || portalposition.lastUpdateTime < j) {
+ iterator.remove();
+ this.destinationCoordinateCache.remove(olong.longValue());
+ }
+ }
+ }
+ }
+
+ public class PortalPosition extends ChunkCoordinates {
+ /**
+ * The worldtime at which this PortalPosition was last verified
+ */
+ public long lastUpdateTime;
+
+ public PortalPosition(int par2, int par3, int par4, long par5) {
+ super(par2, par3, par4);
+ this.lastUpdateTime = par5;
+ }
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/world/WorldChunkManagerCustom.java b/src/main/java/gtPlusPlus/everglades/world/WorldChunkManagerCustom.java
index fc1b2ac425..7618885d08 100644
--- a/src/main/java/gtPlusPlus/everglades/world/WorldChunkManagerCustom.java
+++ b/src/main/java/gtPlusPlus/everglades/world/WorldChunkManagerCustom.java
@@ -1,12 +1,11 @@
package gtPlusPlus.everglades.world;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.everglades.biome.GenLayerEverglades;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
-
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.util.ReportedException;
@@ -19,245 +18,240 @@ import net.minecraft.world.biome.WorldChunkManager;
import net.minecraft.world.gen.layer.GenLayer;
import net.minecraft.world.gen.layer.IntCache;
-import gtPlusPlus.everglades.biome.GenLayerEverglades;
-
public class WorldChunkManagerCustom extends WorldChunkManager {
- private GenLayer genBiomes;
- /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */
- private GenLayer biomeIndexLayer;
- /** The BiomeCache object for this world. */
- private BiomeCache biomeCache;
- /** A list of biomes that the player can spawn in. */
- private List<BiomeGenBase> biomesToSpawnIn;
-
- @SuppressWarnings({ "rawtypes" })
- public WorldChunkManagerCustom() {
- this.biomeCache = new BiomeCache(this);
- this.biomesToSpawnIn = new ArrayList();
- this.biomesToSpawnIn.addAll(allowedBiomes); // TODO
- }
-
- public WorldChunkManagerCustom(long seed, WorldType worldType) {
- this();
- // i changed this to my GenLayerDarkWorld
- GenLayer[] agenlayer = GenLayerEverglades.makeTheWorld(seed, worldType);
-
- agenlayer = getModdedBiomeGenerators(worldType, seed, agenlayer);
- this.genBiomes = agenlayer[0];
- this.biomeIndexLayer = agenlayer[1];
-
- }
-
- public WorldChunkManagerCustom(World world) {
- this(world.getSeed(), world.getWorldInfo().getTerrainType());
-
- }
-
- /**
- * Gets the list of valid biomes for the player to spawn in.
- */
- @Override
- public List<BiomeGenBase> getBiomesToSpawnIn() {
- return this.biomesToSpawnIn;
- }
-
- /**
- * Returns a list of rainfall values for the specified blocks. Args:
- * listToReuse, x, z, width, length.
- */
- @Override
- public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) {
- IntCache.resetIntCache();
-
- if (listToReuse == null || listToReuse.length < width * length) {
- listToReuse = new float[width * length];
- }
-
- int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);
-
- for (int i1 = 0; i1 < width * length; ++i1) {
- try {
- float f = BiomeGenBase.getBiome(aint[i1]).getIntRainfall() / 65536.0F;
-
- if (f > 1.0F) {
- f = 1.0F;
- }
-
- listToReuse[i1] = f;
- }
- catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
- CrashReportCategory crashreportcategory = crashreport.makeCategory("DownfallBlock");
- crashreportcategory.addCrashSection("biome id", Integer.valueOf(i1));
- crashreportcategory.addCrashSection("downfalls[] size", Integer.valueOf(listToReuse.length));
- crashreportcategory.addCrashSection("x", Integer.valueOf(x));
- crashreportcategory.addCrashSection("z", Integer.valueOf(z));
- crashreportcategory.addCrashSection("w", Integer.valueOf(width));
- crashreportcategory.addCrashSection("h", Integer.valueOf(length));
- throw new ReportedException(crashreport);
- }
- }
-
- return listToReuse;
- }
-
- /**
- * Return an adjusted version of a given temperature based on the y
- * height
- */
- @Override
- @SideOnly(Side.CLIENT)
- public float getTemperatureAtHeight(float par1, int par2) {
- return par1;
- }
-
- /**
- * Returns an array of biomes for the location input.
- */
- @Override
- public BiomeGenBase[] getBiomesForGeneration(BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
- IntCache.resetIntCache();
-
- if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
- par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
- }
-
- int[] aint = this.genBiomes.getInts(par2, par3, par4, par5);
-
- try {
- for (int i = 0; i < par4 * par5; ++i) {
- par1ArrayOfBiomeGenBase[i] = BiomeGenBase.getBiome(aint[i]);
- }
-
- return par1ArrayOfBiomeGenBase;
- }
- catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
- CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock");
- crashreportcategory.addCrashSection("biomes[] size", Integer.valueOf(par1ArrayOfBiomeGenBase.length));
- crashreportcategory.addCrashSection("x", Integer.valueOf(par2));
- crashreportcategory.addCrashSection("z", Integer.valueOf(par3));
- crashreportcategory.addCrashSection("w", Integer.valueOf(par4));
- crashreportcategory.addCrashSection("h", Integer.valueOf(par5));
- throw new ReportedException(crashreport);
- }
- }
-
- /**
- * Returns biomes to use for the blocks and loads the other data like
- * temperature and humidity onto the WorldChunkManager Args:
- * oldBiomeList, x, z, width, depth
- */
- @Override
- public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) {
- return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true);
- }
-
- /**
- * Return a list of biomes for the specified blocks. Args: listToReuse,
- * x, y, width, length, cacheFlag (if false, don't check biomeCache to
- * avoid infinite loop in BiomeCacheBlock)
- */
- @Override
- public BiomeGenBase[] getBiomeGenAt(BiomeGenBase[] listToReuse, int x, int y, int width, int length, boolean cacheFlag) {
- IntCache.resetIntCache();
-
- if (listToReuse == null || listToReuse.length < width * length) {
- listToReuse = new BiomeGenBase[width * length];
- }
-
- if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (y & 15) == 0) {
- BiomeGenBase[] abiomegenbase1 = this.biomeCache.getCachedBiomes(x, y);
- System.arraycopy(abiomegenbase1, 0, listToReuse, 0, width * length);
- return listToReuse;
- }
- else {
- int[] aint = this.biomeIndexLayer.getInts(x, y, width, length);
-
- for (int i = 0; i < width * length; ++i) {
- listToReuse[i] = BiomeGenBase.getBiome(aint[i]);
- }
- return listToReuse;
- }
- }
-
- /**
- * checks given Chunk's Biomes against List of allowed ones
- */
- @Override
- @SuppressWarnings("rawtypes")
- public boolean areBiomesViable(int x, int y, int z, List par4List) {
- IntCache.resetIntCache();
- int l = x - z >> 2;
- int i1 = y - z >> 2;
- int j1 = x + z >> 2;
- int k1 = y + z >> 2;
- int l1 = j1 - l + 1;
- int i2 = k1 - i1 + 1;
- int[] aint = this.genBiomes.getInts(l, i1, l1, i2);
-
- try {
- for (int j2 = 0; j2 < l1 * i2; ++j2) {
- BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]);
-
- if (!par4List.contains(biomegenbase)) {
- return false;
- }
- }
-
- return true;
- }
- catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
- CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer");
- crashreportcategory.addCrashSection("Layer", this.genBiomes.toString());
- crashreportcategory.addCrashSection("x", Integer.valueOf(x));
- crashreportcategory.addCrashSection("z", Integer.valueOf(y));
- crashreportcategory.addCrashSection("radius", Integer.valueOf(z));
- crashreportcategory.addCrashSection("allowed", par4List);
- throw new ReportedException(crashreport);
- }
- }
-
- /**
- * Finds a valid position within a range, that is in one of the listed
- * biomes. Searches {par1,par2} +-par3 blocks. Strongly favors positive
- * y positions.
- */
- @Override
- @SuppressWarnings("rawtypes")
- public ChunkPosition findBiomePosition(int p_150795_1_, int p_150795_2_, int p_150795_3_, List p_150795_4_, Random p_150795_5_) {
- IntCache.resetIntCache();
- int l = p_150795_1_ - p_150795_3_ >> 2;
- int i1 = p_150795_2_ - p_150795_3_ >> 2;
- int j1 = p_150795_1_ + p_150795_3_ >> 2;
- int k1 = p_150795_2_ + p_150795_3_ >> 2;
- int l1 = j1 - l + 1;
- int i2 = k1 - i1 + 1;
- int[] aint = this.genBiomes.getInts(l, i1, l1, i2);
- ChunkPosition chunkposition = null;
- int j2 = 0;
-
- for (int k2 = 0; k2 < l1 * i2; ++k2) {
- int l2 = l + k2 % l1 << 2;
- int i3 = i1 + k2 / l1 << 2;
- BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]);
-
- if (p_150795_4_.contains(biomegenbase) && (chunkposition == null || p_150795_5_.nextInt(j2 + 1) == 0)) {
- chunkposition = new ChunkPosition(l2, 0, i3);
- ++j2;
- }
- }
-
- return chunkposition;
- }
-
- /**
- * Calls the WorldChunkManager's biomeCache.cleanupCache()
- */
- @Override
- public void cleanupCache() {
- this.biomeCache.cleanupCache();
- }
-} \ No newline at end of file
+ private GenLayer genBiomes;
+ /** A GenLayer containing the indices into BiomeGenBase.biomeList[] */
+ private GenLayer biomeIndexLayer;
+ /** The BiomeCache object for this world. */
+ private BiomeCache biomeCache;
+ /** A list of biomes that the player can spawn in. */
+ private List<BiomeGenBase> biomesToSpawnIn;
+
+ @SuppressWarnings({"rawtypes"})
+ public WorldChunkManagerCustom() {
+ this.biomeCache = new BiomeCache(this);
+ this.biomesToSpawnIn = new ArrayList();
+ this.biomesToSpawnIn.addAll(allowedBiomes); // TODO
+ }
+
+ public WorldChunkManagerCustom(long seed, WorldType worldType) {
+ this();
+ // i changed this to my GenLayerDarkWorld
+ GenLayer[] agenlayer = GenLayerEverglades.makeTheWorld(seed, worldType);
+
+ agenlayer = getModdedBiomeGenerators(worldType, seed, agenlayer);
+ this.genBiomes = agenlayer[0];
+ this.biomeIndexLayer = agenlayer[1];
+ }
+
+ public WorldChunkManagerCustom(World world) {
+ this(world.getSeed(), world.getWorldInfo().getTerrainType());
+ }
+
+ /**
+ * Gets the list of valid biomes for the player to spawn in.
+ */
+ @Override
+ public List<BiomeGenBase> getBiomesToSpawnIn() {
+ return this.biomesToSpawnIn;
+ }
+
+ /**
+ * Returns a list of rainfall values for the specified blocks. Args:
+ * listToReuse, x, z, width, length.
+ */
+ @Override
+ public float[] getRainfall(float[] listToReuse, int x, int z, int width, int length) {
+ IntCache.resetIntCache();
+
+ if (listToReuse == null || listToReuse.length < width * length) {
+ listToReuse = new float[width * length];
+ }
+
+ int[] aint = this.biomeIndexLayer.getInts(x, z, width, length);
+
+ for (int i1 = 0; i1 < width * length; ++i1) {
+ try {
+ float f = BiomeGenBase.getBiome(aint[i1]).getIntRainfall() / 65536.0F;
+
+ if (f > 1.0F) {
+ f = 1.0F;
+ }
+
+ listToReuse[i1] = f;
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
+ CrashReportCategory crashreportcategory = crashreport.makeCategory("DownfallBlock");
+ crashreportcategory.addCrashSection("biome id", Integer.valueOf(i1));
+ crashreportcategory.addCrashSection("downfalls[] size", Integer.valueOf(listToReuse.length));
+ crashreportcategory.addCrashSection("x", Integer.valueOf(x));
+ crashreportcategory.addCrashSection("z", Integer.valueOf(z));
+ crashreportcategory.addCrashSection("w", Integer.valueOf(width));
+ crashreportcategory.addCrashSection("h", Integer.valueOf(length));
+ throw new ReportedException(crashreport);
+ }
+ }
+
+ return listToReuse;
+ }
+
+ /**
+ * Return an adjusted version of a given temperature based on the y
+ * height
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public float getTemperatureAtHeight(float par1, int par2) {
+ return par1;
+ }
+
+ /**
+ * Returns an array of biomes for the location input.
+ */
+ @Override
+ public BiomeGenBase[] getBiomesForGeneration(
+ BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) {
+ IntCache.resetIntCache();
+
+ if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) {
+ par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5];
+ }
+
+ int[] aint = this.genBiomes.getInts(par2, par3, par4, par5);
+
+ try {
+ for (int i = 0; i < par4 * par5; ++i) {
+ par1ArrayOfBiomeGenBase[i] = BiomeGenBase.getBiome(aint[i]);
+ }
+
+ return par1ArrayOfBiomeGenBase;
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
+ CrashReportCategory crashreportcategory = crashreport.makeCategory("RawBiomeBlock");
+ crashreportcategory.addCrashSection("biomes[] size", Integer.valueOf(par1ArrayOfBiomeGenBase.length));
+ crashreportcategory.addCrashSection("x", Integer.valueOf(par2));
+ crashreportcategory.addCrashSection("z", Integer.valueOf(par3));
+ crashreportcategory.addCrashSection("w", Integer.valueOf(par4));
+ crashreportcategory.addCrashSection("h", Integer.valueOf(par5));
+ throw new ReportedException(crashreport);
+ }
+ }
+
+ /**
+ * Returns biomes to use for the blocks and loads the other data like
+ * temperature and humidity onto the WorldChunkManager Args:
+ * oldBiomeList, x, z, width, depth
+ */
+ @Override
+ public BiomeGenBase[] loadBlockGeneratorData(BiomeGenBase[] oldBiomeList, int x, int z, int width, int depth) {
+ return this.getBiomeGenAt(oldBiomeList, x, z, width, depth, true);
+ }
+
+ /**
+ * Return a list of biomes for the specified blocks. Args: listToReuse,
+ * x, y, width, length, cacheFlag (if false, don't check biomeCache to
+ * avoid infinite loop in BiomeCacheBlock)
+ */
+ @Override
+ public BiomeGenBase[] getBiomeGenAt(
+ BiomeGenBase[] listToReuse, int x, int y, int width, int length, boolean cacheFlag) {
+ IntCache.resetIntCache();
+
+ if (listToReuse == null || listToReuse.length < width * length) {
+ listToReuse = new BiomeGenBase[width * length];
+ }
+
+ if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (y & 15) == 0) {
+ BiomeGenBase[] abiomegenbase1 = this.biomeCache.getCachedBiomes(x, y);
+ System.arraycopy(abiomegenbase1, 0, listToReuse, 0, width * length);
+ return listToReuse;
+ } else {
+ int[] aint = this.biomeIndexLayer.getInts(x, y, width, length);
+
+ for (int i = 0; i < width * length; ++i) {
+ listToReuse[i] = BiomeGenBase.getBiome(aint[i]);
+ }
+ return listToReuse;
+ }
+ }
+
+ /**
+ * checks given Chunk's Biomes against List of allowed ones
+ */
+ @Override
+ @SuppressWarnings("rawtypes")
+ public boolean areBiomesViable(int x, int y, int z, List par4List) {
+ IntCache.resetIntCache();
+ int l = x - z >> 2;
+ int i1 = y - z >> 2;
+ int j1 = x + z >> 2;
+ int k1 = y + z >> 2;
+ int l1 = j1 - l + 1;
+ int i2 = k1 - i1 + 1;
+ int[] aint = this.genBiomes.getInts(l, i1, l1, i2);
+
+ try {
+ for (int j2 = 0; j2 < l1 * i2; ++j2) {
+ BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[j2]);
+
+ if (!par4List.contains(biomegenbase)) {
+ return false;
+ }
+ }
+
+ return true;
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Invalid Biome id");
+ CrashReportCategory crashreportcategory = crashreport.makeCategory("Layer");
+ crashreportcategory.addCrashSection("Layer", this.genBiomes.toString());
+ crashreportcategory.addCrashSection("x", Integer.valueOf(x));
+ crashreportcategory.addCrashSection("z", Integer.valueOf(y));
+ crashreportcategory.addCrashSection("radius", Integer.valueOf(z));
+ crashreportcategory.addCrashSection("allowed", par4List);
+ throw new ReportedException(crashreport);
+ }
+ }
+
+ /**
+ * Finds a valid position within a range, that is in one of the listed
+ * biomes. Searches {par1,par2} +-par3 blocks. Strongly favors positive
+ * y positions.
+ */
+ @Override
+ @SuppressWarnings("rawtypes")
+ public ChunkPosition findBiomePosition(
+ int p_150795_1_, int p_150795_2_, int p_150795_3_, List p_150795_4_, Random p_150795_5_) {
+ IntCache.resetIntCache();
+ int l = p_150795_1_ - p_150795_3_ >> 2;
+ int i1 = p_150795_2_ - p_150795_3_ >> 2;
+ int j1 = p_150795_1_ + p_150795_3_ >> 2;
+ int k1 = p_150795_2_ + p_150795_3_ >> 2;
+ int l1 = j1 - l + 1;
+ int i2 = k1 - i1 + 1;
+ int[] aint = this.genBiomes.getInts(l, i1, l1, i2);
+ ChunkPosition chunkposition = null;
+ int j2 = 0;
+
+ for (int k2 = 0; k2 < l1 * i2; ++k2) {
+ int l2 = l + k2 % l1 << 2;
+ int i3 = i1 + k2 / l1 << 2;
+ BiomeGenBase biomegenbase = BiomeGenBase.getBiome(aint[k2]);
+
+ if (p_150795_4_.contains(biomegenbase) && (chunkposition == null || p_150795_5_.nextInt(j2 + 1) == 0)) {
+ chunkposition = new ChunkPosition(l2, 0, i3);
+ ++j2;
+ }
+ }
+
+ return chunkposition;
+ }
+
+ /**
+ * Calls the WorldChunkManager's biomeCache.cleanupCache()
+ */
+ @Override
+ public void cleanupCache() {
+ this.biomeCache.cleanupCache();
+ }
+}
diff --git a/src/main/java/gtPlusPlus/everglades/world/WorldProviderMod.java b/src/main/java/gtPlusPlus/everglades/world/WorldProviderMod.java
index b5945bcd21..1bd026af72 100644
--- a/src/main/java/gtPlusPlus/everglades/world/WorldProviderMod.java
+++ b/src/main/java/gtPlusPlus/everglades/world/WorldProviderMod.java
@@ -2,70 +2,67 @@ package gtPlusPlus.everglades.world;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import gtPlusPlus.everglades.chunk.ChunkProviderModded;
+import gtPlusPlus.everglades.dimension.Dimension_Everglades;
import net.minecraft.util.Vec3;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldType;
import net.minecraft.world.chunk.IChunkProvider;
-import gtPlusPlus.everglades.chunk.ChunkProviderModded;
-import gtPlusPlus.everglades.dimension.Dimension_Everglades;
-
public class WorldProviderMod extends WorldProvider {
- @Override
- public void registerWorldChunkManager() {
- this.worldChunkMgr = new WorldChunkManagerCustom(this.worldObj.getSeed(), WorldType.AMPLIFIED);
- this.isHellWorld = false;
- this.hasNoSky = false;
- this.dimensionId = Dimension_Everglades.DIMID;
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public Vec3 getFogColor(float par1, float par2) {
- return Vec3.createVectorHelper(0.01568627450980392D, 0.09019607843137255D, 0.0D);
- }
+ @Override
+ public void registerWorldChunkManager() {
+ this.worldChunkMgr = new WorldChunkManagerCustom(this.worldObj.getSeed(), WorldType.AMPLIFIED);
+ this.isHellWorld = false;
+ this.hasNoSky = false;
+ this.dimensionId = Dimension_Everglades.DIMID;
+ }
- @Override
- public IChunkProvider createChunkGenerator() {
- return new ChunkProviderModded(this.worldObj, this.worldObj.getSeed() - 1278);
- }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public Vec3 getFogColor(float par1, float par2) {
+ return Vec3.createVectorHelper(0.01568627450980392D, 0.09019607843137255D, 0.0D);
+ }
- @Override
- public boolean isSurfaceWorld() {
- return true;
- }
+ @Override
+ public IChunkProvider createChunkGenerator() {
+ return new ChunkProviderModded(this.worldObj, this.worldObj.getSeed() - 1278);
+ }
- @Override
- public boolean canCoordinateBeSpawn(int par1, int par2) {
- return false;
- }
+ @Override
+ public boolean isSurfaceWorld() {
+ return true;
+ }
- @Override
- public boolean canRespawnHere() {
- return true;
- }
+ @Override
+ public boolean canCoordinateBeSpawn(int par1, int par2) {
+ return false;
+ }
- @Override
- public float getSunBrightness(float par1) {
- return (par1*2F);
- }
+ @Override
+ public boolean canRespawnHere() {
+ return true;
+ }
- @Override
- public float getStarBrightness(float par1) {
- return (par1*5F);
- }
+ @Override
+ public float getSunBrightness(float par1) {
+ return (par1 * 2F);
+ }
- @Override
- @SideOnly(Side.CLIENT)
- public boolean doesXZShowFog(int par1, int par2) {
- return true;
- }
+ @Override
+ public float getStarBrightness(float par1) {
+ return (par1 * 5F);
+ }
- @Override
- public String getDimensionName() {
- return "dimensionDarkWorld";
- }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public boolean doesXZShowFog(int par1, int par2) {
+ return true;
+ }
-} \ No newline at end of file
+ @Override
+ public String getDimensionName() {
+ return "dimensionDarkWorld";
+ }
+}