From 6d0ac5984482e24d20b1928f7bb61f29b55bc62c Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sun, 28 May 2017 15:58:23 +1000 Subject: - Removed DimensionA. + Added Dark World. + Added New Blocks and Items for Dark World. --- src/Java/gtPlusPlus/GTplusplus.java | 298 +++-- src/Java/gtPlusPlus/GTplusplus_Secondary.java | 81 +- src/Java/gtPlusPlus/core/block/ModBlocks.java | 9 - src/Java/gtPlusPlus/core/world/DimensionIDs.java | 7 - .../core/world/darkworld/Dimension_DarkWorld.java | 1363 ++++++++++++++++++++ .../world/darkworld/biome/Biome_DarkWorld.java | 112 ++ .../darkworld/block/blockDarkWorldPortal.java | 356 +++++ .../darkworld/block/blockDarkWorldPortalFrame.java | 24 + .../darkworld/item/itemDarkWorldPortalTrigger.java | 75 ++ .../core/world/dimensionA/block/BlockModBush.java | 156 --- .../world/dimensionA/block/BlockModPortal.java | 455 ------- .../world/dimensionA/particle/EntityTreeFX.java | 103 -- .../dimensionA/util/Dimension_A_Teleporter.java | 531 -------- .../core/world/dimensionA/util/Names.java | 10 - .../core/world/dimensionA/util/ReadFile.java | 91 -- .../dimensionA/world/ChunkProviderForest.java | 489 ------- .../core/world/dimensionA/world/Dimension.java | 22 - .../dimensionA/world/WorldChunkManagerForest.java | 288 ----- .../dimensionA/world/WorldProviderForest.java | 217 ---- .../world/dimensionA/world/WorldTypesTutorial.java | 59 - .../dimensionA/world/biomes/BiomeDarkForest.java | 48 - .../world/dimensionA/world/biomes/BiomeIDs.java | 8 - .../dimensionA/world/biomes/BiomeLightForest.java | 47 - .../world/dimensionA/world/biomes/ModBiomes.java | 165 --- .../biomes/decorators/BiomeDecoratorHelper.java | 102 -- .../world/biomes/decorators/BiomeDecoratorMod.java | 74 -- .../dimensionA/world/gen/WorldGenEffectTree.java | 212 --- .../world/gen/WorldGenForestAbstractTree.java | 33 - .../world/gen/WorldGenForestBigTree.java | 526 -------- .../dimensionA/world/gen/WorldGenForestGrass.java | 51 - .../dimensionA/world/gen/WorldGenForestTrees.java | 252 ---- .../dimensionA/world/gen/WorldGenModMinable.java | 109 -- .../world/genlayer/LightForestGenLayer.java | 30 - .../world/genlayer/LightForestGenLayerBiomes.java | 33 - .../dimensionA/world/renderers/CloudRenderer.java | 13 - .../dimensionA/world/renderers/SkyRenderer.java | 201 --- .../world/renderers/WeatherRenderer.java | 227 ---- 37 files changed, 2150 insertions(+), 4727 deletions(-) delete mode 100644 src/Java/gtPlusPlus/core/world/DimensionIDs.java create mode 100644 src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java create mode 100644 src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java create mode 100644 src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPortal.java create mode 100644 src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPortalFrame.java create mode 100644 src/Java/gtPlusPlus/core/world/darkworld/item/itemDarkWorldPortalTrigger.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/block/BlockModBush.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/block/BlockModPortal.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/particle/EntityTreeFX.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/util/Dimension_A_Teleporter.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/util/Names.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/util/ReadFile.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/ChunkProviderForest.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/Dimension.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/WorldChunkManagerForest.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/WorldProviderForest.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/WorldTypesTutorial.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeDarkForest.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeIDs.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeLightForest.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/ModBiomes.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/decorators/BiomeDecoratorHelper.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/decorators/BiomeDecoratorMod.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenEffectTree.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestAbstractTree.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestBigTree.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestGrass.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestTrees.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenModMinable.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/genlayer/LightForestGenLayer.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/genlayer/LightForestGenLayerBiomes.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/CloudRenderer.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/SkyRenderer.java delete mode 100644 src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/WeatherRenderer.java (limited to 'src/Java/gtPlusPlus') diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 62b2e6ee23..497ba445c6 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -24,217 +24,211 @@ import gtPlusPlus.core.item.general.RF2EU_Battery; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.item.ItemUtils; -import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.core.world.dimensionA.world.Dimension; -import gtPlusPlus.core.world.dimensionA.world.WorldTypesTutorial; -import gtPlusPlus.core.world.dimensionA.world.biomes.ModBiomes; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; import net.minecraft.launchwrapper.Launch; import net.minecraftforge.common.config.Configuration; -@Mod(modid=CORE.MODID, name=CORE.name, version=CORE.VERSION, dependencies="required-after:Forge; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO;") -public class GTplusplus -implements ActionListener -{ +@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO;") +public class GTplusplus implements ActionListener { @Mod.Instance(CORE.MODID) public static GTplusplus instance; protected static Meta_GT_Proxy gregtechproxy; - @SidedProxy(clientSide="gtPlusPlus.core.proxy.ClientProxy", serverSide="gtPlusPlus.core.proxy.ServerProxy") + @SidedProxy(clientSide = "gtPlusPlus.core.proxy.ClientProxy", serverSide = "gtPlusPlus.core.proxy.ServerProxy") public static CommonProxy proxy; - - public static void handleConfigFile(final FMLPreInitializationEvent event) { - final Configuration config = new Configuration(new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg")); + final Configuration config = new Configuration( + new File(event.getModConfigurationDirectory(), "GTplusplus/GTplusplus.cfg")); config.load(); - - //Debug - DEBUG = config.getBoolean("debugMode", "debug", false, "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)"); - disableEnderIOIntegration = config.getBoolean("disableEnderIO", "debug", false, "Disables EnderIO Integration."); - - - //Machines - enableThaumcraftShardUnification = config.getBoolean("enableThaumcraftShardUnification", "machines", false, "Allows the use of TC shards across many recipes by oreDicting them into a common group."); - enableAlternativeBatteryAlloy = config.getBoolean("enableAlternativeBatteryAlloy", "machines", false, "Adds a non-Antimony using Battery Alloy. Not Balanced at all.."); - disableIC2Recipes = config.getBoolean("disableIC2Recipes", "machines", false, "Alkaluscraft Related - Removes IC2 Cables Except glass fibre. Few other Misc Tweaks."); - enableAlternativeDivisionSigilRecipe = config.getBoolean("enableAlternativeDivisionSigilRecipe", "machines", false, "Utilizes Neutronium instead."); - - //Tools - CORE.configSwitches.enableSkookumChoochers = config.getBoolean("enableSkookumChoochers", "gregtech", true, "Adds Custom GT Tools, called Skookum Choochers, functioning as a hard hammer and a wrench."); - CORE.configSwitches.enableMultiSizeTools = config.getBoolean("enableMultiSizeTools", "gregtech", true, "Adds Custom GT Shovels and Pickaxes which mine in a 3x3 style. One of each whill be generated for each Gregtech Material which has Dense Plates and Long Rods available."); - - //Pipes & Cables - CORE.configSwitches.enableCustom_Pipes = config.getBoolean("enableCustom_Pipes", "gregtech", true, "Adds Custom GT Fluid Pipes."); - CORE.configSwitches.enableCustom_Cables = config.getBoolean("enableCustom_Cables", "gregtech", true, "Adds Custom GT Cables."); - - //Block Drops - CORE.configSwitches.chanceToDropDrainedShard = config.getInt("chanceToDropDrainedShard", "blockdrops", 196, 0, 10000, "Drained shards have a 1 in X chance to drop."); - CORE.configSwitches.chanceToDropFluoriteOre = config.getInt("chanceToDropFluoriteOre", "blockdrops", 32, 0, 10000, "Fluorite Ore has a 1 in X chance to drop from Limestone and a 1 in X*20 from Sandstone.."); - - - //Single machines - CORE.configSwitches.enableMachine_SolarGenerators = config.getBoolean("enableSolarGenerators", "gregtech", false, "These may be overpowered, Consult a local electrician."); - CORE.configSwitches.enableMachine_Safes = config.getBoolean("enableMachineSafes", "gregtech", true, "These protect your goodies/rare stuff."); - CORE.configSwitches.enableMachine_Dehydrators = config.getBoolean("enableMachineDehydrators", "gregtech", true, "These dehydrate stuff."); - CORE.configSwitches.enableMachine_SteamConverter = config.getBoolean("enableMachineSteamConverter", "gregtech", true, "Converts IC2 steam -> Railcraft steam."); - CORE.configSwitches.enableMachine_FluidTanks = config.getBoolean("enableMachineFluidTanks", "gregtech", true, "Portable fluid tanks."); - CORE.configSwitches.enableMachine_RocketEngines = config.getBoolean("enableMachineRocketEngines", "gregtech", true, "Diesel egines with different internals, they consume less fuel overall."); - CORE.configSwitches.enableMachine_GeothermalEngines = config.getBoolean("enableMachineGeothermalEngines", "gregtech", true, "These may be overpowered, Consult a local geologist."); - - - //Multi machines - CORE.configSwitches.enableMultiblock_AlloyBlastSmelter = config.getBoolean("enableMultiblockAlloyBlastSmelter", "gregtech", true, "Required to smelt most high tier materials from GT++. Also smelts everything else to molten metal."); - CORE.configSwitches.enableMultiblock_IndustrialCentrifuge = config.getBoolean("enableMultiblockIndustrialCentrifuge", "gregtech", true, "Spin, Spin, Spiiiin."); - CORE.configSwitches.enableMultiblock_IndustrialCokeOven = config.getBoolean("enableMultiblockIndustrialCokeOven", "gregtech", true, "Pyro Oven Alternative, older, more realistic, better."); - CORE.configSwitches.enableMultiblock_IndustrialElectrolyzer = config.getBoolean("enableMultiblockIndustrialElectrolyzer", "gregtech", true, "Electrolyzes things with extra bling factor."); - CORE.configSwitches.enableMultiblock_IndustrialMacerationStack = config.getBoolean("enableMultiblockIndustrialMacerationStack", "gregtech", true, "A hyper efficient maceration tower, nets more bonus outputs."); - CORE.configSwitches.enableMultiblock_IndustrialPlatePress = config.getBoolean("enableMultiblockIndustrialPlatePress", "gregtech", true, "Industrial bendering machine thingo."); - CORE.configSwitches.enableMultiblock_IndustrialWireMill = config.getBoolean("enableMultiblockIndustrialWireMill", "gregtech", true, "Produces fine wire and exotic cables."); - CORE.configSwitches.enableMultiblock_IronBlastFurnace = config.getBoolean("enableMultiblockIronBlastFurnace", "gregtech", true, "Skip the Bronze age, very slowly."); - CORE.configSwitches.enableMultiblock_MatterFabricator = config.getBoolean("enableMultiblockMatterFabricator", "gregtech", true, "?FAB?RIC?ATE MA?TT?ER."); - CORE.configSwitches.enableMultiblock_MultiTank = config.getBoolean("enableMultiblockMultiTank", "gregtech", true, "Tall tanks, each layer adds extra fluid storage."); - CORE.configSwitches.enableMultiblock_PowerSubstation = config.getBoolean("enableMultiblockPowerSubstation", "gregtech", true, "For managing large power grids."); - CORE.configSwitches.enableMultiblock_LiquidFluorideThoriumReactor = config.getBoolean("enableMultiblockLiquidFluorideThoriumReactor", "gregtech", true, "For supplying large power grids."); - CORE.configSwitches.enableMultiblock_NuclearFuelRefinery = config.getBoolean("enableMultiblock_NuclearFuelRefinery", "gregtech", true, "Refines molten chemicals into nuclear fuels."); - CORE.configSwitches.enableMultiblock_IndustrialSifter = config.getBoolean("enableMultiblock_IndustrialSifter", "gregtech", true, "Large scale sifting."); - - - //Options - RF2EU_Battery.rfPerEU = config.getInt("rfUsedPerEUForUniversalBatteries", "configurables", 4, 1, 1000, "How much RF is a single unit of EU worth? (Most mods use 4:1 ratio)"); - - //Features - enableCustomAlvearyBlocks = config.getBoolean("enableCustomAlvearyBlocks", "features", false, "Enables Custom Alveary Blocks."); + // Debug + DEBUG = config.getBoolean("debugMode", "debug", false, + "Enables all sorts of debug logging. (Don't use unless told to, breaks other things.)"); + disableEnderIOIntegration = config.getBoolean("disableEnderIO", "debug", false, + "Disables EnderIO Integration."); + + // Machines + enableThaumcraftShardUnification = config.getBoolean("enableThaumcraftShardUnification", "machines", false, + "Allows the use of TC shards across many recipes by oreDicting them into a common group."); + enableAlternativeBatteryAlloy = config.getBoolean("enableAlternativeBatteryAlloy", "machines", false, + "Adds a non-Antimony using Battery Alloy. Not Balanced at all.."); + disableIC2Recipes = config.getBoolean("disableIC2Recipes", "machines", false, + "Alkaluscraft Related - Removes IC2 Cables Except glass fibre. Few other Misc Tweaks."); + enableAlternativeDivisionSigilRecipe = config.getBoolean("enableAlternativeDivisionSigilRecipe", "machines", + false, "Utilizes Neutronium instead."); + + // Tools + CORE.configSwitches.enableSkookumChoochers = config.getBoolean("enableSkookumChoochers", "gregtech", true, + "Adds Custom GT Tools, called Skookum Choochers, functioning as a hard hammer and a wrench."); + CORE.configSwitches.enableMultiSizeTools = config.getBoolean("enableMultiSizeTools", "gregtech", true, + "Adds Custom GT Shovels and Pickaxes which mine in a 3x3 style. One of each whill be generated for each Gregtech Material which has Dense Plates and Long Rods available."); + + // Pipes & Cables + CORE.configSwitches.enableCustom_Pipes = config.getBoolean("enableCustom_Pipes", "gregtech", true, + "Adds Custom GT Fluid Pipes."); + CORE.configSwitches.enableCustom_Cables = config.getBoolean("enableCustom_Cables", "gregtech", true, + "Adds Custom GT Cables."); + + // Block Drops + CORE.configSwitches.chanceToDropDrainedShard = config.getInt("chanceToDropDrainedShard", "blockdrops", 196, 0, + 10000, "Drained shards have a 1 in X chance to drop."); + CORE.configSwitches.chanceToDropFluoriteOre = config.getInt("chanceToDropFluoriteOre", "blockdrops", 32, 0, + 10000, "Fluorite Ore has a 1 in X chance to drop from Limestone and a 1 in X*20 from Sandstone.."); + + // Single machines + CORE.configSwitches.enableMachine_SolarGenerators = config.getBoolean("enableSolarGenerators", "gregtech", + false, "These may be overpowered, Consult a local electrician."); + CORE.configSwitches.enableMachine_Safes = config.getBoolean("enableMachineSafes", "gregtech", true, + "These protect your goodies/rare stuff."); + CORE.configSwitches.enableMachine_Dehydrators = config.getBoolean("enableMachineDehydrators", "gregtech", true, + "These dehydrate stuff."); + CORE.configSwitches.enableMachine_SteamConverter = config.getBoolean("enableMachineSteamConverter", "gregtech", + true, "Converts IC2 steam -> Railcraft steam."); + CORE.configSwitches.enableMachine_FluidTanks = config.getBoolean("enableMachineFluidTanks", "gregtech", true, + "Portable fluid tanks."); + CORE.configSwitches.enableMachine_RocketEngines = config.getBoolean("enableMachineRocketEngines", "gregtech", + true, "Diesel egines with different internals, they consume less fuel overall."); + CORE.configSwitches.enableMachine_GeothermalEngines = config.getBoolean("enableMachineGeothermalEngines", + "gregtech", true, "These may be overpowered, Consult a local geologist."); + + // Multi machines + CORE.configSwitches.enableMultiblock_AlloyBlastSmelter = config.getBoolean("enableMultiblockAlloyBlastSmelter", + "gregtech", true, + "Required to smelt most high tier materials from GT++. Also smelts everything else to molten metal."); + CORE.configSwitches.enableMultiblock_IndustrialCentrifuge = config + .getBoolean("enableMultiblockIndustrialCentrifuge", "gregtech", true, "Spin, Spin, Spiiiin."); + CORE.configSwitches.enableMultiblock_IndustrialCokeOven = config.getBoolean( + "enableMultiblockIndustrialCokeOven", "gregtech", true, + "Pyro Oven Alternative, older, more realistic, better."); + CORE.configSwitches.enableMultiblock_IndustrialElectrolyzer = config.getBoolean( + "enableMultiblockIndustrialElectrolyzer", "gregtech", true, + "Electrolyzes things with extra bling factor."); + CORE.configSwitches.enableMultiblock_IndustrialMacerationStack = config.getBoolean( + "enableMultiblockIndustrialMacerationStack", "gregtech", true, + "A hyper efficient maceration tower, nets more bonus outputs."); + CORE.configSwitches.enableMultiblock_IndustrialPlatePress = config.getBoolean( + "enableMultiblockIndustrialPlatePress", "gregtech", true, "Industrial bendering machine thingo."); + CORE.configSwitches.enableMultiblock_IndustrialWireMill = config.getBoolean( + "enableMultiblockIndustrialWireMill", "gregtech", true, "Produces fine wire and exotic cables."); + CORE.configSwitches.enableMultiblock_IronBlastFurnace = config.getBoolean("enableMultiblockIronBlastFurnace", + "gregtech", true, "Skip the Bronze age, very slowly."); + CORE.configSwitches.enableMultiblock_MatterFabricator = config.getBoolean("enableMultiblockMatterFabricator", + "gregtech", true, "?FAB?RIC?ATE MA?TT?ER."); + CORE.configSwitches.enableMultiblock_MultiTank = config.getBoolean("enableMultiblockMultiTank", "gregtech", + true, "Tall tanks, each layer adds extra fluid storage."); + CORE.configSwitches.enableMultiblock_PowerSubstation = config.getBoolean("enableMultiblockPowerSubstation", + "gregtech", true, "For managing large power grids."); + CORE.configSwitches.enableMultiblock_LiquidFluorideThoriumReactor = config.getBoolean( + "enableMultiblockLiquidFluorideThoriumReactor", "gregtech", true, "For supplying large power grids."); + CORE.configSwitches.enableMultiblock_NuclearFuelRefinery = config.getBoolean( + "enableMultiblock_NuclearFuelRefinery", "gregtech", true, + "Refines molten chemicals into nuclear fuels."); + CORE.configSwitches.enableMultiblock_IndustrialSifter = config.getBoolean("enableMultiblock_IndustrialSifter", + "gregtech", true, "Large scale sifting."); + + // Options + RF2EU_Battery.rfPerEU = config.getInt("rfUsedPerEUForUniversalBatteries", "configurables", 4, 1, 1000, + "How much RF is a single unit of EU worth? (Most mods use 4:1 ratio)"); + + // Features + enableCustomAlvearyBlocks = config.getBoolean("enableCustomAlvearyBlocks", "features", false, + "Enables Custom Alveary Blocks."); config.save(); } - public static String randomDust_A; - public static String randomDust_B; - public static String randomDust_C; - public static String randomDust_D; - - protected void FirstCall(){ - Utils.LOG_WARNING("Summoning up mystic powers."); - final String[] infusedDusts = {"Fire", "Water", "Earth", "Air", "Order", "Entropy"}; - final int a = MathUtils.randInt(0, 5); - final int b = MathUtils.randInt(0, 5); - final int c = MathUtils.randInt(0, 5); - final int d = MathUtils.randInt(0, 5); - final String infusedDust1 = "dustInfused"+infusedDusts[a]; - final String infusedDust2 = "dustInfused"+infusedDusts[b]; - final String infusedDust3 = "dustInfused"+infusedDusts[c]; - final String infusedDust4 = "dustInfused"+infusedDusts[d]; - Utils.LOG_INFO("Found the aspect of "+infusedDusts[a]+" to embody into energy crystals."); - Utils.LOG_INFO("Found the aspect of "+infusedDusts[b]+" to embody into energy crystals."); - Utils.LOG_INFO("Found the aspect of "+infusedDusts[c]+" to embody into energy crystals."); - Utils.LOG_INFO("Found the aspect of "+infusedDusts[d]+" to embody into energy crystals."); - randomDust_A = infusedDust1; - randomDust_B = infusedDust2; - randomDust_C = infusedDust3; - randomDust_D = infusedDust4; - //ItemStack a1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[a], 8); - //ItemStack b1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[b], 8); - //ItemStack c1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[c], 8); - //ItemStack d1 = UtilsItems.getItemStackOfAmountFromOreDict("dustInfused"+infusedDusts[d], 8); - - - } - - @SideOnly(value=Side.CLIENT) - public static void loadTextures(){ + // Loads Textures + @SideOnly(value = Side.CLIENT) + public static void loadTextures() { Utils.LOG_INFO("Loading some textures on the client."); - //Tools - Utils.LOG_WARNING("Processing texture: "+TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile().getResourcePath()); + // Tools + Utils.LOG_WARNING("Processing texture: " + TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile().getResourcePath()); - //Blocks - Utils.LOG_WARNING("Processing texture: "+TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath()); + // Blocks + Utils.LOG_WARNING( + "Processing texture: " + TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath()); } - - - - //Pre-Init + // Pre-Init @Mod.EventHandler - public void preInit(final FMLPreInitializationEvent event) - { - Utils.LOG_INFO("Loading "+CORE.name+" V"+CORE.VERSION); + public void preInit(final FMLPreInitializationEvent event) { + Utils.LOG_INFO("Loading " + CORE.name + " V" + CORE.VERSION); CORE.DEVENV = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment"); - Utils.LOG_INFO("Latest is "+CORE.MASTER_VERSION+". Updated? "+Utils.isModUpToDate()); - Utils.LOG_INFO("User's Country: "+CORE.USER_COUNTRY); - - //FirstCall(); + Utils.LOG_INFO("Latest is " + CORE.MASTER_VERSION + ". Updated? " + Utils.isModUpToDate()); + Utils.LOG_INFO("User's Country: " + CORE.USER_COUNTRY); + + // FirstCall(); FMLCommonHandler.instance().bus().register(new LoginEventHandler()); Utils.LOG_INFO("Login Handler Initialized"); + // Handle GT++ Config handleConfigFile(event); - - //HANDLER_GT.mMaterialProperties = new GT_Config(new Configuration(new File(new File(event.getModConfigurationDirectory(), "GTplusplus"), "MaterialProperties.cfg"))); + + // HANDLER_GT.mMaterialProperties = new GT_Config(new Configuration(new + // File(new File(event.getModConfigurationDirectory(), "GTplusplus"), + // "MaterialProperties.cfg"))); proxy.preInit(event); } - //Init + // Init @Mod.EventHandler - public void init(final FMLInitializationEvent event) - { + public void init(final FMLInitializationEvent event) { proxy.init(event); - + Utils.LOG_INFO("[Proxy] Calling Entity registrator."); proxy.registerEntities(); Utils.LOG_INFO("[Proxy] Calling Tile Entity registrator."); proxy.registerTileEntities(); Utils.LOG_INFO("[Proxy] Calling Render registrator."); proxy.registerRenderThings(); - + proxy.registerNetworkStuff(); - - //Register Dimension A - ModBiomes.registerWithBiomeDictionary(); - Dimension.registerWorldProvider(); - Dimension.registerDimensions(); - WorldTypesTutorial.addCustomWorldTypes(); - - + } - //Post-Init + // Post-Init @Mod.EventHandler public void postInit(final FMLPostInitializationEvent event) { proxy.postInit(event); - if (DEBUG){ + if (DEBUG) { this.dumpGtRecipeMap(Gregtech_Recipe_Map.sChemicalDehydratorRecipes); this.dumpGtRecipeMap(Gregtech_Recipe_Map.sCokeOvenRecipes); this.dumpGtRecipeMap(Gregtech_Recipe_Map.sMatterFab2Recipes); this.dumpGtRecipeMap(Gregtech_Recipe_Map.sAlloyBlastSmelterRecipes); } - //~ + // ~ ReflectionUtils.becauseIWorkHard(); - //Utils.LOG_INFO("Activating GT OreDictionary Handler, this can take some time."); + // Utils.LOG_INFO("Activating GT OreDictionary Handler, this can take + // some time."); Utils.LOG_INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - Utils.LOG_INFO("| Recipes succesfully Loaded: "+RegistrationHandler.recipesSuccess+" | Failed: "+RegistrationHandler.recipesFailed + " |"); + Utils.LOG_INFO("| Recipes succesfully Loaded: " + RegistrationHandler.recipesSuccess + " | Failed: " + + RegistrationHandler.recipesFailed + " |"); Utils.LOG_INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); - //Meta_GT_Proxy.activateOreDictHandler(); + // Meta_GT_Proxy.activateOreDictHandler(); Utils.LOG_INFO("Finally, we are finished. Have some cripsy bacon as a reward."); } @EventHandler - public void serverStarting(final FMLServerStartingEvent event) - { + public void load(FMLInitializationEvent event) { + + } + + @EventHandler + public void serverStarting(final FMLServerStartingEvent event) { event.registerServerCommand(new CommandMath()); } @Mod.EventHandler - public void serverStopping(final FMLServerStoppingEvent event) - { + public void serverStopping(final FMLServerStoppingEvent event) { } @@ -243,17 +237,17 @@ implements ActionListener } - protected void dumpGtRecipeMap(final GT_Recipe_Map r){ + protected void dumpGtRecipeMap(final GT_Recipe_Map r) { final Collection x = r.mRecipeList; - Utils.LOG_INFO("Dumping "+r.mUnlocalizedName+" Recipes for Debug."); - for(final GT_Recipe newBo : x){ + Utils.LOG_INFO("Dumping " + r.mUnlocalizedName + " Recipes for Debug."); + for (final GT_Recipe newBo : x) { Utils.LOG_INFO("========================"); - Utils.LOG_INFO("Dumping Input: "+ItemUtils.getArrayStackNames(newBo.mInputs)); - Utils.LOG_INFO("Dumping Inputs "+ItemUtils.getFluidArrayStackNames(newBo.mFluidInputs)); - Utils.LOG_INFO("Dumping Duration: "+newBo.mDuration); - Utils.LOG_INFO("Dumping EU/t: "+newBo.mEUt); - Utils.LOG_INFO("Dumping Output: "+ItemUtils.getArrayStackNames(newBo.mOutputs)); - Utils.LOG_INFO("Dumping Output: "+ItemUtils.getFluidArrayStackNames(newBo.mFluidOutputs)); + Utils.LOG_INFO("Dumping Input: " + ItemUtils.getArrayStackNames(newBo.mInputs)); + Utils.LOG_INFO("Dumping Inputs " + ItemUtils.getFluidArrayStackNames(newBo.mFluidInputs)); + Utils.LOG_INFO("Dumping Duration: " + newBo.mDuration); + Utils.LOG_INFO("Dumping EU/t: " + newBo.mEUt); + Utils.LOG_INFO("Dumping Output: " + ItemUtils.getArrayStackNames(newBo.mOutputs)); + Utils.LOG_INFO("Dumping Output: " + ItemUtils.getFluidArrayStackNames(newBo.mFluidOutputs)); Utils.LOG_INFO("========================"); } } diff --git a/src/Java/gtPlusPlus/GTplusplus_Secondary.java b/src/Java/gtPlusPlus/GTplusplus_Secondary.java index 5311f0f6c1..259c959590 100644 --- a/src/Java/gtPlusPlus/GTplusplus_Secondary.java +++ b/src/Java/gtPlusPlus/GTplusplus_Secondary.java @@ -1,5 +1,7 @@ package gtPlusPlus; +import java.util.Random; + import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; @@ -7,27 +9,92 @@ import cofh.mod.ChildMod; import cpw.mods.fml.common.*; import cpw.mods.fml.common.Mod.CustomProperty; import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.event.FMLInitializationEvent; -import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.*; +import cpw.mods.fml.common.registry.GameRegistry; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; +import gtPlusPlus.core.world.darkworld.biome.Biome_DarkWorld; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraft.world.chunk.IChunkProvider; -@ChildMod(parent = CORE.MODID, mod = @Mod(modid = "Gregtech++", -name = "GT++", +@ChildMod(parent = CORE.MODID, mod = @Mod(modid = "GT++DarkWorld", +name = "GT++ Dark World", version = CORE.VERSION, dependencies = "after:Miscutils;after:Gregtech", customProperties = @CustomProperty(k = "cofhversion", v = "true"))) -public class GTplusplus_Secondary { +public class GTplusplus_Secondary implements IFuelHandler, IWorldGenerator{ + + public static final String MODID2 = "GT++ Dark World"; + public static final String VERSION2 = "0.1"; - private static final String name = "Gregtech++"; + // Dark World Handler + Biome_DarkWorld DarkWorld_Biome = new Biome_DarkWorld(); + Dimension_DarkWorld DarkWorld_Dimension = new Dimension_DarkWorld(); @EventHandler public void load(final FMLInitializationEvent e) { + Utils.LOG_INFO("Begin resource allocation for " + MODID2 + " V" + VERSION2); try { initMod(); } catch (final Throwable $) { final ModContainer This = FMLCommonHandler.instance().findContainerFor(this); LogManager.getLogger(This.getModId()).log(Level.ERROR, "There was a problem loading " + This.getName(), $); } + + //Load Dark World and Biome + GameRegistry.registerFuelHandler(this); + GameRegistry.registerWorldGenerator(this, 1); + DarkWorld_Biome.load(); + DarkWorld_Dimension.load(); + + } + + // Pre-Init + @Mod.EventHandler + public void preInit(final FMLPreInitializationEvent event) { + Utils.LOG_INFO("Loading " + MODID2 + " V" + VERSION2); + + // Load Dark World + DarkWorld_Biome.instance = GTplusplus.instance; + DarkWorld_Dimension.instance = GTplusplus.instance; + DarkWorld_Biome.preInit(event); + DarkWorld_Dimension.preInit(event); + } + + @EventHandler + public void serverLoad(FMLServerStartingEvent event) { + DarkWorld_Biome.serverLoad(event); + DarkWorld_Dimension.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 == -1) { + DarkWorld_Biome.generateNether(world, random, chunkX, chunkZ); + } + if (world.provider.dimensionId == 0) { + DarkWorld_Biome.generateSurface(world, random, chunkX, chunkZ); + } + if (world.provider.dimensionId == -1) { + DarkWorld_Dimension.generateNether(world, random, chunkX, chunkZ); + } + if (world.provider.dimensionId == 0) { + + } + } private static void initMod() { @@ -36,7 +103,7 @@ public class GTplusplus_Secondary { @EventHandler public static void postInit(final FMLPostInitializationEvent e) { - + Utils.LOG_INFO("Finished loading Dark World plugin for GT++."); } } diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 370690c1be..e5f5de3436 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -8,7 +8,6 @@ import gtPlusPlus.core.block.machine.*; import gtPlusPlus.core.fluids.FluidRegistryHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.world.dimensionA.block.BlockModPortal; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; @@ -43,10 +42,6 @@ public final class ModBlocks { public static Block blockHellfire; - //TODO - public static BlockModPortal lightPortal; - - public static void init() { Utils.LOG_INFO("Initializing Blocks."); //blockGriefSaver = new TowerDevice().setBlockName("blockGriefSaver").setCreativeTab(AddToCreativeTab.tabBlock).setBlockTextureName("blockDefault"); @@ -71,10 +66,6 @@ public final class ModBlocks { blockOreFluorite = new BlockBaseOre("oreFluorite", "Fluorite", Material.rock, BlockTypes.ORE, Utils.rgbtoHexValue(120, 120, 30), 3); blockMiningExplosive = new MiningExplosives(); blockHellfire = new HellFire(); - - //TODO - lightPortal = new BlockModPortal("dimensionPortalA"); - GameRegistry.registerBlock(lightPortal, "dimensionPortalA"); } diff --git a/src/Java/gtPlusPlus/core/world/DimensionIDs.java b/src/Java/gtPlusPlus/core/world/DimensionIDs.java deleted file mode 100644 index 52ed10ccef..0000000000 --- a/src/Java/gtPlusPlus/core/world/DimensionIDs.java +++ /dev/null @@ -1,7 +0,0 @@ -package gtPlusPlus.core.world; - -public class DimensionIDs { - - public static final int Dimension_A = 210; - -} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java b/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java new file mode 100644 index 0000000000..b44b05ede6 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/Dimension_DarkWorld.java @@ -0,0 +1,1363 @@ +package gtPlusPlus.core.world.darkworld; + +import java.util.*; + +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.core.world.darkworld.biome.Biome_DarkWorld; +import gtPlusPlus.core.world.darkworld.block.blockDarkWorldPortal; +import gtPlusPlus.core.world.darkworld.block.blockDarkWorldPortalFrame; +import gtPlusPlus.core.world.darkworld.item.itemDarkWorldPortalTrigger; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.CrashReportCategory; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.*; +import net.minecraft.world.*; +import net.minecraft.world.biome.*; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.*; +import net.minecraft.world.gen.feature.WorldGenLakes; +import net.minecraft.world.gen.layer.*; +import net.minecraft.world.gen.structure.*; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.terraingen.*; + +@SuppressWarnings("unchecked") +public class Dimension_DarkWorld { + + public Object instance; + public static int DIMID = 93; + + public static blockDarkWorldPortal portal; + public static itemDarkWorldPortalTrigger block; + public static Block blockTopLayer = Block.getBlockFromItem(ItemUtils.getCorrectStacktype("minecraft:dirt:2", 1).getItem()); + public static Block blockSecondLayer = Blocks.dirt; + public static Block blockMainFiller = Blocks.stone; + public static Block blockSecondaryFiller; + public static Block blockFluidLakes = Blocks.lava; + + public static Block blockPortalFrame; + + static { + + portal = new blockDarkWorldPortal(); + block = (itemDarkWorldPortalTrigger) (new itemDarkWorldPortalTrigger().setUnlocalizedName("dimensionDarkWorld_trigger")); + Item.itemRegistry.addObject(423, "dimensionDarkWorld_trigger", block); + blockPortalFrame = new blockDarkWorldPortalFrame(); + } + + public Dimension_DarkWorld() { + } + + public void load() { + GameRegistry.registerBlock(portal, "dimensionDarkWorld_portal"); + DimensionManager.registerProviderType(DIMID, Dimension_DarkWorld.WorldProviderMod.class, false); + DimensionManager.registerDimension(DIMID, DIMID); + GameRegistry.addSmelting(Items.record_11, new ItemStack(block), 1.0f); + + } + + public void registerRenderers() { + } + + public void generateNether(World world, Random random, int chunkX, int chunkZ) { + } + + public void generateSurface(World world, Random random, int chunkX, int chunkZ) { + } + + public int addFuel(ItemStack fuel) { + return 0; + } + + public void serverLoad(FMLServerStartingEvent event) { + } + + public void preInit(FMLPreInitializationEvent event) { + } + + public static class WorldProviderMod extends WorldProvider { + + @Override + public void registerWorldChunkManager() { + this.worldChunkMgr = new WorldChunkManagerCustom(this.worldObj.getSeed(), WorldType.DEFAULT); + this.isHellWorld = true; + this.hasNoSky = true; + this.dimensionId = DIMID; + } + + @Override + @SideOnly(Side.CLIENT) + public Vec3 getFogColor(float par1, float par2) { + return Vec3.createVectorHelper(0.01568627450980392D, 0.09019607843137255D, 0.0D); + } + + @Override + public IChunkProvider createChunkGenerator() { + return new ChunkProviderModded(this.worldObj, this.worldObj.getSeed() - 1278); + } + + @Override + public boolean isSurfaceWorld() { + return false; + } + + @Override + public boolean canCoordinateBeSpawn(int par1, int par2) { + return false; + } + + @Override + public boolean canRespawnHere() { + return true; + } + + @Override + @SideOnly(Side.CLIENT) + public boolean doesXZShowFog(int par1, int par2) { + return true; + } + + @Override + public String getDimensionName() { + return "dimensionDarkWorld"; + } + + } + + public class DarkWorldPortalPosition extends ChunkCoordinates { + public long field_85087_d; + final TeleporterDimensionMod field_85088_e; + + public DarkWorldPortalPosition(TeleporterDimensionMod darkworldTeleporter, int par2, int par3, int par4, long par5) { + super(par2, par3, par4); + this.field_85088_e = darkworldTeleporter; + this.field_85087_d = par5; + } + } + + public static 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 ? 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) == portal) { + while (this.worldServerInstance.getBlock(l3, i2 - 1, l1) == portal) { + --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) == portal) { + i4 = 2; + } + + if (this.worldServerInstance.getBlock(i + 1, j, k) == portal) { + i4 = 0; + } + + if (this.worldServerInstance.getBlock(i, j, k - 1) == portal) { + i4 = 3; + } + + if (this.worldServerInstance.getBlock(i, j, k + 1) == portal) { + 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 ? 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 ? blockPortalFrame : portal, 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; + } + } + } + + public static class ChunkProviderModded implements IChunkProvider { + private Random rand; + private NoiseGeneratorOctaves field_147431_j; + private NoiseGeneratorOctaves field_147432_k; + private NoiseGeneratorOctaves field_147429_l; + private NoiseGeneratorPerlin field_147430_m; + /** + * A NoiseGeneratorOctaves used in generating terrain + */ + public NoiseGeneratorOctaves noiseGen5; + /** + * A NoiseGeneratorOctaves used in generating terrain + */ + public NoiseGeneratorOctaves noiseGen6; + public NoiseGeneratorOctaves mobSpawnerNoise; + /** + * Reference to the World object. + */ + private World worldObj; + private WorldType field_147435_p; + private final double[] field_147434_q; + private final float[] parabolicField; + private double[] stoneNoise = new double[256]; + private MapGenBase caveGenerator = new MapGenCaves(); + /** + * Holds Stronghold Generator + */ + private MapGenStronghold strongholdGenerator = new MapGenStronghold(); + /** + * Holds Village Generator + */ + private MapGenVillage villageGenerator = new MapGenVillage(); + /** + * Holds Mineshaft Generator + */ + private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft(); + private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature(); + /** + * Holds ravine generator + */ + private MapGenBase ravineGenerator = new MapGenRavine(); + /** + * The biomes that are used to generate the chunk + */ + private BiomeGenBase[] biomesForGeneration; + double[] field_147427_d; + double[] field_147428_e; + double[] field_147425_f; + double[] field_147426_g; + int[][] field_73219_j = new int[32][32]; + { + caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, + net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE); + strongholdGenerator = (MapGenStronghold) TerrainGen.getModdedMapGen(strongholdGenerator, + net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD); + villageGenerator = (MapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, + net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE); + mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, + net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT); + scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, + net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE); + ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, + net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE); + } + + public ChunkProviderModded(World par1World, long par2) { + this.worldObj = par1World; + this.field_147435_p = par1World.getWorldInfo().getTerrainType(); + this.rand = new Random(par2); + this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16); + this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16); + this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8); + this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4); + this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10); + this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16); + this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8); + this.field_147434_q = new double[825]; + this.parabolicField = new float[25]; + + for (int j = -2; j <= 2; ++j) { + for (int k = -2; k <= 2; ++k) { + float f = 10.0F / MathHelper.sqrt_float(j * j + k * k + 0.2F); + this.parabolicField[j + 2 + (k + 2) * 5] = f; + } + } + + NoiseGenerator[] noiseGens = { field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, + noiseGen6, mobSpawnerNoise }; + noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens); + this.field_147431_j = (NoiseGeneratorOctaves) noiseGens[0]; + this.field_147432_k = (NoiseGeneratorOctaves) noiseGens[1]; + this.field_147429_l = (NoiseGeneratorOctaves) noiseGens[2]; + this.field_147430_m = (NoiseGeneratorPerlin) noiseGens[3]; + this.noiseGen5 = (NoiseGeneratorOctaves) noiseGens[4]; + this.noiseGen6 = (NoiseGeneratorOctaves) noiseGens[5]; + this.mobSpawnerNoise = (NoiseGeneratorOctaves) noiseGens[6]; + } + + public void func_147424_a(int p_147424_1_, int p_147424_2_, Block[] p_147424_3_) { + byte b0 = 63; + this.biomesForGeneration = this.worldObj.getWorldChunkManager() + .getBiomesForGeneration(this.biomesForGeneration, p_147424_1_ * 4 - 2, p_147424_2_ * 4 - 2, 10, 10); + this.func_147423_a(p_147424_1_ * 4, 0, p_147424_2_ * 4); + + for (int k = 0; k < 4; ++k) { + int l = k * 5; + int i1 = (k + 1) * 5; + + for (int j1 = 0; j1 < 4; ++j1) { + int k1 = (l + j1) * 33; + int l1 = (l + j1 + 1) * 33; + int i2 = (i1 + j1) * 33; + int j2 = (i1 + j1 + 1) * 33; + + for (int k2 = 0; k2 < 32; ++k2) { + double d0 = 0.125D; + double d1 = this.field_147434_q[k1 + k2]; + double d2 = this.field_147434_q[l1 + k2]; + double d3 = this.field_147434_q[i2 + k2]; + double d4 = this.field_147434_q[j2 + k2]; + double d5 = (this.field_147434_q[k1 + k2 + 1] - d1) * d0; + double d6 = (this.field_147434_q[l1 + k2 + 1] - d2) * d0; + double d7 = (this.field_147434_q[i2 + k2 + 1] - d3) * d0; + double d8 = (this.field_147434_q[j2 + k2 + 1] - d4) * d0; + + for (int l2 = 0; l2 < 8; ++l2) { + double d9 = 0.25D; + double d10 = d1; + double d11 = d2; + double d12 = (d3 - d1) * d9; + double d13 = (d4 - d2) * d9; + + for (int i3 = 0; i3 < 4; ++i3) { + int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2; + short short1 = 256; + j3 -= short1; + double d14 = 0.25D; + double d16 = (d11 - d10) * d14; + double d15 = d10 - d16; + + for (int k3 = 0; k3 < 4; ++k3) { + if ((d15 += d16) > 0.0D) { + p_147424_3_[j3 += short1] = blockMainFiller; + } + else if (k2 * 8 + l2 < b0) { + p_147424_3_[j3 += short1] = blockFluidLakes; + } + else { + p_147424_3_[j3 += short1] = null; + } + } + + d10 += d12; + d11 += d13; + } + + d1 += d5; + d2 += d6; + d3 += d7; + d4 += d8; + } + } + } + } + } + + public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_) { + @SuppressWarnings("deprecation") + ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, + p_147422_2_, p_147422_3_, p_147422_5_); + MinecraftForge.EVENT_BUS.post(event); + if (event.getResult() == cpw.mods.fml.common.eventhandler.Event.Result.DENY) + return; + + double d0 = 0.03125D; + this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, p_147422_1_ * 16, p_147422_2_ * 16, 16, + 16, d0 * 2.0D, d0 * 2.0D, 1.0D); + + for (int k = 0; k < 16; ++k) { + for (int l = 0; l < 16; ++l) { + BiomeGenBase biomegenbase = p_147422_5_[l + k * 16]; + biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, + p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]); + } + } + } + + /** + * loads or generates the chunk at the chunk location specified + */ + @Override + public Chunk loadChunk(int par1, int par2) { + return this.provideChunk(par1, par2); + } + + /** + * Will return back a chunk, if it doesn't exist and its not a MP client + * it will generates all the blocks for the specified chunk from the map + * seed and chunk seed + */ + @Override + public Chunk provideChunk(int par1, int par2) { + this.rand.setSeed(par1 * 341873128712L + par2 * 132897987541L); + Block[] ablock = new Block[65536]; + byte[] abyte = new byte[65536]; + this.func_147424_a(par1, par2, ablock); + this.biomesForGeneration = this.worldObj.getWorldChunkManager() + .loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16); + this.replaceBlocksForBiome(par1, par2, ablock, abyte, this.biomesForGeneration); + + Chunk chunk = new Chunk(this.worldObj, ablock, abyte, par1, par2); + byte[] abyte1 = chunk.getBiomeArray(); + + for (int k = 0; k < abyte1.length; ++k) { + abyte1[k] = (byte) this.biomesForGeneration[k].biomeID; + } + + chunk.generateSkylightMap(); + return chunk; + } + + private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_) { + this.field_147426_g = this.noiseGen6.generateNoiseOctaves(this.field_147426_g, p_147423_1_, p_147423_3_, 5, + 5, 200.0D, 200.0D, 0.5D); + this.field_147427_d = this.field_147429_l.generateNoiseOctaves(this.field_147427_d, p_147423_1_, + p_147423_2_, p_147423_3_, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D); + this.field_147428_e = this.field_147431_j.generateNoiseOctaves(this.field_147428_e, p_147423_1_, + p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D); + this.field_147425_f = this.field_147432_k.generateNoiseOctaves(this.field_147425_f, p_147423_1_, + p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D); + int l = 0; + int i1 = 0; + for (int j1 = 0; j1 < 5; ++j1) { + for (int k1 = 0; k1 < 5; ++k1) { + float f = 0.0F; + float f1 = 0.0F; + float f2 = 0.0F; + byte b0 = 2; + BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10]; + + for (int l1 = -b0; l1 <= b0; ++l1) { + for (int i2 = -b0; i2 <= b0; ++i2) { + BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10]; + float f3 = biomegenbase1.rootHeight; + float f4 = biomegenbase1.heightVariation; + + if (this.field_147435_p == WorldType.AMPLIFIED && f3 > 0.0F) { + f3 = 1.0F + f3 * 2.0F; + f4 = 1.0F + f4 * 4.0F; + } + + float f5 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F); + + if (biomegenbase1.rootHeight > biomegenbase.rootHeight) { + f5 /= 2.0F; + } + + f += f4 * f5; + f1 += f3 * f5; + f2 += f5; + } + } + + f /= f2; + f1 /= f2; + f = f * 0.9F + 0.1F; + f1 = (f1 * 4.0F - 1.0F) / 8.0F; + double d13 = this.field_147426_g[i1] / 8000.0D; + + if (d13 < 0.0D) { + d13 = -d13 * 0.3D; + } + + d13 = d13 * 3.0D - 2.0D; + + if (d13 < 0.0D) { + d13 /= 2.0D; + + if (d13 < -1.0D) { + d13 = -1.0D; + } + + d13 /= 1.4D; + d13 /= 2.0D; + } + else { + if (d13 > 1.0D) { + d13 = 1.0D; + } + + d13 /= 8.0D; + } + + ++i1; + double d12 = f1; + double d14 = f; + d12 += d13 * 0.2D; + d12 = d12 * 8.5D / 8.0D; + double d5 = 8.5D + d12 * 4.0D; + + for (int j2 = 0; j2 < 33; ++j2) { + double d6 = (j2 - d5) * 12.0D * 128.0D / 256.0D / d14; + + if (d6 < 0.0D) { + d6 *= 4.0D; + } + + double d7 = this.field_147428_e[l] / 512.0D; + double d8 = this.field_147425_f[l] / 512.0D; + double d9 = (this.field_147427_d[l] / 10.0D + 1.0D) / 2.0D; + double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6; + + if (j2 > 29) { + double d11 = (j2 - 29) / 3.0F; + d10 = d10 * (1.0D - d11) + -10.0D * d11; + } + + this.field_147434_q[l] = d10; + ++l; + } + } + } + } + + /** + * Checks to see if a chunk exists at x, y + */ + @Override + public boolean chunkExists(int par1, int par2) { + return true; + } + + /** + * Populates chunk with ores etc etc + */ + @Override + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { + BlockFalling.fallInstantly = true; + int k = par2 * 16; + int l = par3 * 16; + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16); + this.rand.setSeed(this.worldObj.getSeed()); + long i1 = this.rand.nextLong() / 2L * 2L + 1L; + long j1 = this.rand.nextLong() / 2L * 2L + 1L; + this.rand.setSeed(par2 * i1 + par3 * j1 ^ this.worldObj.getSeed()); + boolean flag = false; + + MinecraftForge.EVENT_BUS + .post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag)); + + int k1; + int l1; + int i2; + + if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGe