diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2017-05-28 15:58:23 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2017-05-28 15:58:23 +1000 |
commit | 6d0ac5984482e24d20b1928f7bb61f29b55bc62c (patch) | |
tree | d647382cfaa07566c104fc309fe86553d9306acc | |
parent | 8866af1647dca9846dc33ec59792cf845904e8eb (diff) | |
download | GT5-Unofficial-6d0ac5984482e24d20b1928f7bb61f29b55bc62c.tar.gz GT5-Unofficial-6d0ac5984482e24d20b1928f7bb61f29b55bc62c.tar.bz2 GT5-Unofficial-6d0ac5984482e24d20b1928f7bb61f29b55bc62c.zip |
- Removed DimensionA.
+ Added Dark World.
+ Added New Blocks and Items for Dark World.
37 files changed, 2150 insertions, 4727 deletions
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<GT_Recipe> 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 != BiomeGenBase.desertHills && !flag + && this.rand.nextInt(4) == 0 && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, + flag, net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE)) { + k1 = k + this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(256); + i2 = l + this.rand.nextInt(16) + 8; + (new WorldGenLakes(blockFluidLakes)).generate(this.worldObj, this.rand, k1, l1, i2); + } + + if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, + net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA) && !flag + && this.rand.nextInt(8) == 0) { + k1 = k + this.rand.nextInt(16) + 8; + l1 = this.rand.nextInt(this.rand.nextInt(248) + 8); + i2 = l + this.rand.nextInt(16) + 8; + + if (l1 < 63 || this.rand.nextInt(10) == 0) { + (new WorldGenLakes(blockFluidLakes)).generate(this.worldObj, this.rand, k1, l1, i2); + } + } + biomegenbase.decorate(this.worldObj, this.rand, k, l); + SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); + k += 8; + l += 8; + + MinecraftForge.EVENT_BUS + .post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); + + BlockFalling.fallInstantly = false; + } + + /** + * Two modes of operation: if passed true, save all Chunks in one go. If + * passed false, save up to two chunks. Return true if all chunks have + * been saved. + */ + @Override + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { + return true; + } + + /** + * Save extra data not associated with any Chunk. Not saved during + * autosave, only during world unload. Currently unimplemented. + */ + @Override + public void saveExtraData() { + } + + /** + * Unloads chunks that are marked to be unloaded. This is not guaranteed + * to unload every such chunk. + */ + @Override + public boolean unloadQueuedChunks() { + return false; + } + + /** + * Returns if the IChunkProvider supports saving. + */ + @Override + public boolean canSave() { + return true; + } + + /** + * Converts the instance data to a readable string. + */ + @Override + public String makeString() { + return "RandomLevelSource"; + } + + /** + * Returns a list of creatures of the specified type that can spawn at + * the given location. + */ + @SuppressWarnings("rawtypes") + @Override + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) { + BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4); + return par1EnumCreatureType == EnumCreatureType.monster + && this.scatteredFeatureGenerator.func_143030_a(par2, par3, par4) + ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() + : biomegenbase.getSpawnableList(par1EnumCreatureType); + } + + @Override + public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_) { + return "Stronghold".equals(p_147416_2_) && this.strongholdGenerator != null + ? this.strongholdGenerator.func_151545_a(p_147416_1_, p_147416_3_, p_147416_4_, p_147416_5_) : null; + } + + @Override + public int getLoadedChunkCount() { + return 0; + } + + @Override + public void recreateStructures(int par1, int par2) { + + } + } + + public static 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); + } + + public WorldChunkManagerCustom(long seed, WorldType worldType) { + this(); + // i changed this to my GenLayerDarkWorld + GenLayer[] agenlayer = LightForestGenLayer.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(); + } + } + + public static class LightForestGenLayer extends GenLayer { + + public LightForestGenLayer(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 }; + } + + @Override + public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_) { + return null; + } + } + + public static class GenLayerBiomes extends GenLayer { + + protected BiomeGenBase[] allowedBiomes = { Biome_DarkWorld.biome, }; + + public GenLayerBiomes(long seed) { + super(seed); + } + + 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; + } + } + +} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java b/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java new file mode 100644 index 0000000000..e899b34025 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/biome/Biome_DarkWorld.java @@ -0,0 +1,112 @@ +package gtPlusPlus.core.world.darkworld.biome; + +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 gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; +import net.minecraft.entity.monster.*; +import net.minecraft.entity.passive.*; +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_DarkWorld { + + public static BiomeGenbiomeDarkWorld biome = new BiomeGenbiomeDarkWorld(); + + public Object instance; + + public Biome_DarkWorld() { + } + + public void load() { + BiomeDictionary.registerBiomeType(biome, BiomeDictionary.Type.DESERT); + BiomeManager.addSpawnBiome(biome); + // BiomeManager.desertBiomes.add(new BiomeManager.BiomeEntry(biome, + // 10)); + } + + 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 BiomeGenbiomeDarkWorld extends BiomeGenBase { + @SuppressWarnings("unchecked") + public BiomeGenbiomeDarkWorld() { + super(40); + setBiomeName("biomeDarkWorld"); + topBlock = Dimension_DarkWorld.blockTopLayer; + fillerBlock = Dimension_DarkWorld.blockSecondLayer; + theBiomeDecorator.generateLakes = true; + theBiomeDecorator.treesPerChunk = 50; + theBiomeDecorator.flowersPerChunk = 4; + theBiomeDecorator.grassPerChunk = 10; + theBiomeDecorator.deadBushPerChunk = 25; + theBiomeDecorator.mushroomsPerChunk = 5; + theBiomeDecorator.reedsPerChunk = 1; + theBiomeDecorator.cactiPerChunk = 1; + theBiomeDecorator.sandPerChunk = 8; + rainfall = 0.7F; + setHeight(new BiomeGenBase.Height(0.15F, 0.8F)); + waterColorMultiplier = 0x2d0b2d; + + this.spawnableMonsterList.clear(); + this.spawnableCreatureList.clear(); + this.spawnableWaterCreatureList.clear(); + this.spawnableCaveCreatureList.clear(); + this.spawnableMonsterList.add(new SpawnListEntry(EntityBat.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityBlaze.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityCaveSpider.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityCreeper.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityEnderman.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityGhast.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityGiantZombie.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityMagmaCube.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityPigZombie.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySkeleton.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySpider.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntitySquid.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityWolf.class, 5, 1, 5)); + this.spawnableMonsterList.add(new SpawnListEntry(EntityZombie.class, 5, 1, 5)); + + } + + @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 0x333333; + } + + } + +} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPortal.java b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPortal.java new file mode 100644 index 0000000000..52b47edaa0 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPortal.java @@ -0,0 +1,356 @@ +package gtPlusPlus.core.world.darkworld.block; + +import java.util.Random; + +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; +import net.minecraft.block.Block; +import net.minecraft.block.BlockBreakable; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemMonsterPlacer; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +public class blockDarkWorldPortal extends BlockBreakable { + IIcon gor = null, dol = null, st1 = null, st2 = null, st3 = null, st4 = null; + + public blockDarkWorldPortal() { + super("portal", Material.portal, false); + this.setTickRandomly(true); + this.setHardness(-1.0F); + this.setLightLevel(0.75F); + this.setCreativeTab(CreativeTabs.tabBlock); + this.setBlockName("blockDarkWorldPortal"); + LanguageRegistry.addName(this, "Portal to the Dark World"); + + } + + @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 par2, int par3, int par4, Random par5Random) { + super.updateTick(par1World, par2, par3, par4, par5Random); + if (par1World.provider.isSurfaceWorld()) { + int l; + for (l = par3; !World.doesBlockHaveSolidTopSurface(par1World, par2, l, par4) && l > 0; --l) { + ; + } + if (l > 0 && !par1World.isBlockNormalCubeDefault(par2, l + 1, par4, true)) { + Entity entity = ItemMonsterPlacer.spawnCreature(par1World, 57, par2 + 0.5D, l + 1.1D, par4 + 0.5D); + if (entity != null) { + entity.timeUntilPortal = entity.getPortalCooldown(); + } + } + } + } + + /** + * 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_DarkWorld.blockPortalFrame + || par1World.getBlock(par2 + 1, par3, par4) == Dimension_DarkWorld.blockPortalFrame) { + b0 = 1; + } + if (par1World.getBlock(par2, par3, par4 - 1) == Dimension_DarkWorld.blockPortalFrame + || par1World.getBlock(par2, par3, par4 + 1) == Dimension_DarkWorld.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_DarkWorld.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(World par1World, int par2, int par3, int par4, int par5) { + byte b0 = 0; + byte b1 = 1; + if (par1World.getBlock(par2 - 1, par3, par4) == this || par1World.getBlock(par2 + 1, par3, par4) == this) { + b0 = 1; + b1 = 0; + } + int i1; + for (i1 = par3; par1World.getBlock(par2, i1 - 1, par4) == this; --i1) { + ; + } + if (par1World.getBlock(par2, i1 - 1, par4) != Dimension_DarkWorld.blockPortalFrame) { + par1World.setBlockToAir(par2, par3, par4); + } else { + int j1; + for (j1 = 1; j1 < 4 && par1World.getBlock(par2, i1 + j1, par4) == this; ++j1) { + ; + } + if (j1 == 3 && par1World.getBlock(par2, i1 + j1, par4) == Dimension_DarkWorld.blockPortalFrame) { + boolean flag = par1World.getBlock(par2 - 1, par3, par4) == this || par1World.getBlock(par2 + 1, par3, par4) == this; + boolean flag1 = par1World.getBlock(par2, par3, par4 - 1) == this || par1World.getBlock(par2, par3, par4 + 1) == this; + if (flag && flag1) { + par1World.setBlockToAir(par2, par3, par4); + } else { + if ((par1World.getBlock(par2 + b0, par3, par4 + b1) != Dimension_DarkWorld.blockPortalFrame || par1World + .getBlock(par2 - b0, par3, par4 - b1) != this) + && (par1World.getBlock(par2 - b0, par3, par4 - b1) != Dimension_DarkWorld.blockPortalFrame || par1World.getBlock(par2 + b0, par3, + par4 + b1) != this)) { + par1World.setBlockToAir(par2, par3, par4); + } + } + } else { + par1World.setBlockToAir(par2, par3, par4); + } + } + } + + @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 = 10; + } else if (thePlayer.dimension != Dimension_DarkWorld.DIMID) { + thePlayer.timeUntilPortal = 10; + thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, Dimension_DarkWorld.DIMID, + new Dimension_DarkWorld.TeleporterDimensionMod(thePlayer.mcServer.worldServerForDimension(Dimension_DarkWorld.DIMID))); + } else { + thePlayer.timeUntilPortal = 10; + thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, + new Dimension_DarkWorld.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 (par5Random.nextInt(100) == 0) { + par1World.playSound(par2 + 0.5D, par3 + 0.5D, par4 + 0.5D, "portal.portal", 0.5F, + par5Random.nextFloat() * 0.4F + 0.8F, false); + } + for (int l = 0; l < 4; ++l) { + double d0 = par2 + par5Random.nextFloat(); + double d1 = par3 + par5Random.nextFloat(); + double d2 = par4 + par5Random.nextFloat(); + double d3 = 0.0D; + double d4 = 0.0D; + double d5 = 0.0D; + int i1 = par5Random.nextInt(2) * 2 - 1; + d3 = (par5Random.nextFloat() - 0.5D) * 0.5D; + d4 = (par5Random.nextFloat() - 0.5D) * 0.5D; + d5 = (par5Random.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 = par5Random.nextFloat() * 2.0F * i1; + } else { + d2 = par4 + 0.5D + 0.25D * i1; + d5 = par5Random.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(255, 128, 0); + } + + @Override + public int getRenderColor(final int aMeta) { + return Utils.rgbtoHexValue(255, 128, 0); + } +} + + diff --git a/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPortalFrame.java b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPortalFrame.java new file mode 100644 index 0000000000..699da8d272 --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/block/blockDarkWorldPortalFrame.java @@ -0,0 +1,24 @@ +package gtPlusPlus.core.world.darkworld.block; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +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{ + + public blockDarkWorldPortalFrame() { + super(Material.iron); + this.setCreativeTab(AddToCreativeTab.tabBOP); + this.setBlockName("blockDarkWorldPortalFrame"); + this.setHardness(3.0F); + this.setLightLevel(0.5F); + this.setBlockTextureName(CORE.MODID + ":" + "SwirlRed"); + LanguageRegistry.addName(this, "Mystical Frame"); + GameRegistry.registerBlock(this, "blockDarkWorldPortalFrame"); + + } + +} diff --git a/src/Java/gtPlusPlus/core/world/darkworld/item/itemDarkWorldPortalTrigger.java b/src/Java/gtPlusPlus/core/world/darkworld/item/itemDarkWorldPortalTrigger.java new file mode 100644 index 0000000000..ab9349121d --- /dev/null +++ b/src/Java/gtPlusPlus/core/world/darkworld/item/itemDarkWorldPortalTrigger.java @@ -0,0 +1,75 @@ +package gtPlusPlus.core.world.darkworld.item; + +import java.util.List; + +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.world.darkworld.Dimension_DarkWorld; +import net.minecraft.block.Block; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +public class itemDarkWorldPortalTrigger extends Item { + public itemDarkWorldPortalTrigger() { + super(); + this.maxStackSize = 1; + setMaxDamage(64); + setCreativeTab(CreativeTabs.tabTools); + this.setTextureName(CORE.MODID + ":" + "itemAlkalusDisk"); + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return "Alkalus Disk [Activated]"; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(EnumChatFormatting.GRAY+"A key for entering the Dark World."); + super.addInformation(stack, aPlayer, list, bool); + } + + @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); + Dimension_DarkWorld.portal.tryToCreatePortal(par3World, par4, par5, par6); + } + par1ItemStack.damageItem(1, par2EntityPlayer); + return true; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/block/BlockModBush.java b/src/Java/gtPlusPlus/core/world/dimensionA/block/BlockModBush.java deleted file mode 100644 index 6b467322c8..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/block/BlockModBush.java +++ /dev/null @@ -1,156 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.block; - -import static net.minecraftforge.common.EnumPlantType.*; - -import java.util.Random; - -import cpw.mods.fml.common.registry.GameRegistry; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Blocks; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; -import net.minecraftforge.common.EnumPlantType; -import net.minecraftforge.common.IPlantable; -import net.minecraftforge.common.util.ForgeDirection; - -public class BlockModBush extends Block implements IPlantable { - protected BlockModBush(Material p_i45395_1_) - { - super(p_i45395_1_); - this.setTickRandomly(true); - float f = 0.2F; - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3.0F, 0.5F + f); - this.setCreativeTab(CreativeTabs.tabDecorations); - GameRegistry.registerBlock(this, "modBush"); - } - - protected BlockModBush() - { - this(Material.plants); - } - - /** - * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z - */ - @Override - public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_) - { - return super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.canBlockStay(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_); - } - - /** - * is the block grass, dirt or farmland - */ - protected boolean canPlaceBlockOn(Block p_149854_1_) - { - return p_149854_1_ == Blocks.grass || p_149854_1_ == Blocks.dirt; - } - - /** - * 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 Block - */ - @Override - public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) - { - super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_); - this.checkAndDropBlock(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); - } - - /** - * Ticks the block if it's been scheduled - */ - @Override - public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) - { - this.checkAndDropBlock(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); - } - - /** - * checks if the block can stay, if not drop as item - */ - protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_) - { - if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_)) - { - this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_, p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_), 0); - p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, getBlockById(0), 0, 2); - } - } - - /** - * Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. - */ - @Override - public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_) - { - return p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_).canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this); - } - - /** - * 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 p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_) - { - return null; - } - - /** - * 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; - } - - /** - * The type of render function that is called for this block - */ - @Override - public int getRenderType() - { - return 1; - } - - @Override - public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) - { - if (this == Blocks.wheat) return Crop; - if (this == Blocks.carrots) return Crop; - if (this == Blocks.potatoes) return Crop; - if (this == Blocks.melon_stem) return Crop; - if (this == Blocks.pumpkin_stem) return Crop; - if (this == Blocks.waterlily) return Water; - if (this == Blocks.nether_wart) return Nether; - if (this == Blocks.sapling) return Plains; - return Plains; - } - - @Override - public Block getPlant(IBlockAccess world, int x, int y, int z) - { - return this; - } - - @Override - public int getPlantMetadata(IBlockAccess world, int x, int y, int z) - { - return world.getBlockMetadata(x, y, z); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/block/BlockModPortal.java b/src/Java/gtPlusPlus/core/world/dimensionA/block/BlockModPortal.java deleted file mode 100644 index 5fa45a5b41..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/block/BlockModPortal.java +++ /dev/null @@ -1,455 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.block; - -import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.math.MathUtils; -import gtPlusPlus.core.world.DimensionIDs; -import gtPlusPlus.core.world.dimensionA.util.Dimension_A_Teleporter; -import net.minecraft.block.Block; -import net.minecraft.block.BlockBreakable; -import net.minecraft.block.material.Material; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemMonsterPlacer; -import net.minecraft.util.*; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public class BlockModPortal extends BlockBreakable -{ - public static final int[][] field_150001_a = new int[][] {new int[0], {3, 1}, {2, 0}}; - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000284"; - - public BlockModPortal(String name) - { - super("portal", Material.portal, false); - this.setTickRandomly(true); - this.setBlockName(name); - this.setBlockTextureName("tutorial:" + name); - this.setCreativeTab(CreativeTabs.tabBlock); - } - - /** - * Ticks the block if it's been scheduled - */ - @Override - public void updateTick(World world, int x, int y, int z, Random random) { - super.updateTick(world, x, y, z, random); - if (world.provider.isSurfaceWorld() && world.getGameRules().getGameRuleBooleanValue("doMobSpawning") && random.nextInt(2000) < world.difficultySetting.getDifficultyId()) { - int l; - for (l = y; !World.doesBlockHaveSolidTopSurface(world, x, l, z) && l > 0; --l) { - ; - } - if (l > 0 && !world.getBlock(x, l + 1, z).isNormalCube()) { - Entity entity = ItemMonsterPlacer.spawnCreature(world, 57, x + 0.5D, l + 1.1D, z + 0.5D); - if (entity != null) { - entity.timeUntilPortal = entity.getPortalCooldown(); - } - } - } - } - - /** - * 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 world, int x, int y, int z) { - return null; - } - - /** - * Updates the blocks bounds based on its current state. Args: world, x, y, z - */ - @Override - public void setBlockBoundsBasedOnState(IBlockAccess blockaccess, int x, int y, int z) { - int l = func_149999_b(blockaccess.getBlockMetadata(x, y, z)); - if (l == 0) { - if (blockaccess.getBlock(x - 1, y, z) != this && blockaccess.getBlock(x + 1, y, z) != this) { - l = 2; - } else { - l = 1; - } - if (blockaccess instanceof World && !((World)blockaccess).isRemote) { - ((World)blockaccess).setBlockMetadataWithNotify(x, y, z, l, 2); - } - } - float f = 0.125F; - float f1 = 0.125F; - if (l == 1) { - f = 0.5F; - } - if (l == 2) { - f1 = 0.5F; - } - this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f1, 0.5F + f, 1.0F, 0.5F + f1); - } - - /** - * 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; - } - - public boolean getPortalSize(World world, int x, int y, int z) { - BlockModPortal.Size size = new BlockModPortal.Size(world, x, y, z, 1); - BlockModPortal.Size size1 = new BlockModPortal.Size(world, x, y, z, 2); - if (size.func_150860_b() && size.field_150864_e == 0) { - size.func_150859_c(); - return true; - } - else if (size1.func_150860_b() && size1.field_150864_e == 0) { - size1.func_150859_c(); - return true; - } else { - return false; - } - } - - /** - * 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 Block - */ - @Override - public void onNeighborBlockChange(World world, int x, int y, int z, Block block){ - int l = func_149999_b(world.getBlockMetadata(x, y, z)); - BlockModPortal.Size size = new BlockModPortal.Size(world, x, y, z, 1); - BlockModPortal.Size size1 = new BlockModPortal.Size(world, x, y, z, 2); - if (l == 1 && (!size.func_150860_b() || size.field_150864_e < size.field_150868_h * size.field_150862_g)) - { - world.setBlock(x, y, z, Blocks.air); - } - else if (l == 2 && (!size1.func_150860_b() || size1.field_150864_e < size1.field_150868_h * size1.field_150862_g)) - { - world.setBlock(x, y, z, Blocks.air); - } - else if (l == 0 && !size.func_150860_b() && !size1.func_150860_b()) - { - world.setBlock(x, y, z, Blocks.air); - } - } - - /** - * 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 - */ - @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) - { - int i1 = 0; - - if (p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_) == this) - { - i1 = func_149999_b(p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_)); - - if (i1 == 0) - { - return false; - } - - if (i1 == 2 && p_149646_5_ != 5 && p_149646_5_ != 4) - { - return false; - } - - if (i1 == 1 && p_149646_5_ != 3 && p_149646_5_ != 2) - { - return false; - } - } - - boolean flag = p_149646_1_.getBlock(p_149646_2_ - 1, p_149646_3_, p_149646_4_) == this && p_149646_1_.getBlock(p_149646_2_ - 2, p_149646_3_, p_149646_4_) != this; - boolean flag1 = p_149646_1_.getBlock(p_149646_2_ + 1, p_149646_3_, p_149646_4_) == this && p_149646_1_.getBlock(p_149646_2_ + 2, p_149646_3_, p_149646_4_) != this; - boolean flag2 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_ - 1) == this && p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_ - 2) != this; - boolean flag3 = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_ + 1) == this && p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_ + 2) != this; - boolean flag4 = flag || flag1 || i1 == 1; - boolean flag5 = flag2 || flag3 || i1 == 2; - return flag4 && p_149646_5_ == 4 ? true : (flag4 && p_149646_5_ == 5 ? true : (flag5 && p_149646_5_ == 2 ? true : flag5 && p_149646_5_ == 3)); - } - - /** - * Returns the quantity of items to drop on block destruction. - */ - @Override - public int quantityDropped(Random p_149745_1_) - { - 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 world, int x, int y, int z, Entity entity) { - if ((entity.ridingEntity == null) && (entity.riddenByEntity == null) && ((entity instanceof EntityPlayerMP))) { - EntityPlayerMP thePlayer = (EntityPlayerMP)entity; - if (thePlayer.timeUntilPortal > 0) { - thePlayer.timeUntilPortal = 10; - } else if (thePlayer.dimension != DimensionIDs.Dimension_A) { - thePlayer.timeUntilPortal = 10; - thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, DimensionIDs.Dimension_A, new Dimension_A_Teleporter(thePlayer.mcServer.worldServerForDimension(DimensionIDs.Dimension_A))); - } else { - thePlayer.timeUntilPortal = 10; - thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new Dimension_A_Teleporter(thePlayer.mcServer.worldServerForDimension(0))); - } - } - } - - /** - * Returns which pass should this block be rendered on. 0 for solids and 1 for alpha - */ - @Override - @SideOnly(Side.CLIENT) - public int getRenderBlockPass() { - return 1; - } - - /** - * A randomly called display update to be able to add particles or other items for display - */ - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, int x, int y, int z, Random random){ - if (random.nextInt(100) == 0) { - world.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "portal.portal", 0.5F, random.nextFloat() * 0.4F + 0.8F, false); - } - for (int l = 0; l < 4; ++l) { - double d0 = x + random.nextFloat(); - double d1 = y + random.nextFloat(); - double d2 = z + random.nextFloat(); - double d3 = 0.0D; - double d4 = 0.0D; - double d5 = 0.0D; - int i1 = random.nextInt(2) * 2 - 1; - d3 = (random.nextFloat() - 0.5D) * 0.5D; - d4 = (random.nextFloat() - 0.5D) * 0.5D; - d5 = (random.nextFloat() - 0.5D) * 0.5D; - if (world.getBlock(x - 1, y, z) != this && world.getBlock(x + 1, y, z) != this) { - d0 = x + 0.5D + 0.25D * i1; - d3 = random.nextFloat() * 2.0F * i1; - } else { - d2 = z + 0.5D + 0.25D * i1; - d5 = random.nextFloat() * 2.0F * i1; - } - world.spawnParticle("portal", d0, d1, d2, d3, d4, d5); - } - } - - public static int func_149999_b(int p_149999_0_) - { - return p_149999_0_ & 3; - } - - /** - * Gets an item for the block being called on. Args: world, x, y, z - */ - @Override - @SideOnly(Side.CLIENT) - public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { - return Item.getItemById(0); - } - - public static class Size - { - private final World worldObj; - private final int field_150865_b; - private final int field_150866_c; - private final int field_150863_d; - private int field_150864_e = 0; - private ChunkCoordinates field_150861_f; - private int field_150862_g; - private int field_150868_h; - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000285"; - - public Size(World p_i45415_1_, int p_i45415_2_, int p_i45415_3_, int p_i45415_4_, int p_i45415_5_) - { - this.worldObj = p_i45415_1_; - this.field_150865_b = p_i45415_5_; - this.field_150863_d = BlockModPortal.field_150001_a[p_i45415_5_][0]; - this.field_150866_c = BlockModPortal.field_150001_a[p_i45415_5_][1]; - - for (int i1 = p_i45415_3_; p_i45415_3_ > i1 - 21 && p_i45415_3_ > 0 && this.getBlockMaterial(p_i45415_1_.getBlock(p_i45415_2_, p_i45415_3_ - 1, p_i45415_4_)); --p_i45415_3_) - { - ; - } - - int j1 = this.func_150853_a(p_i45415_2_, p_i45415_3_, p_i45415_4_, this.field_150863_d) - 1; - - if (j1 >= 0) - { - this.field_150861_f = new ChunkCoordinates(p_i45415_2_ + j1 * Direction.offsetX[this.field_150863_d], p_i45415_3_, p_i45415_4_ + j1 * Direction.offsetZ[this.field_150863_d]); - this.field_150868_h = this.func_150853_a(this.field_150861_f.posX, this.field_150861_f.posY, this.field_150861_f.posZ, this.field_150866_c); - - if (this.field_150868_h < 2 || this.field_150868_h > 21) - { - this.field_150861_f = null; - this.field_150868_h = 0; - } - } - - if (this.field_150861_f != null) - { - this.field_150862_g = this.func_150858_a(); - } - } - - protected int func_150853_a(int x, int y, int z, int p_150853_4_) - { - int j1 = Direction.offsetX[p_150853_4_]; - int k1 = Direction.offsetZ[p_150853_4_]; - int i1; - Block block; - - for (i1 = 0; i1 < 22; ++i1) - { - block = this.worldObj.getBlock(x + j1 * i1, y, z + k1 * i1); - - if (!this.getBlockMaterial(block)) - { - break; - } - - Block block1 = this.worldObj.getBlock(x + j1 * i1, y - 1, z + k1 * i1); - - if (block1 != Blocks.stone) - { - break; - } - } - - block = this.worldObj.getBlock(x + j1 * i1, y, z + k1 * i1); - return block == Blocks.stone ? i1 : 0; - } - - protected int func_150858_a() - { - int i; - int j; - int k; - int l; - label56: - - for (this.field_150862_g = 0; this.field_150862_g < 21; ++this.field_150862_g) - { - i = this.field_150861_f.posY + this.field_150862_g; - - for (j = 0; j < this.field_150868_h; ++j) - { - k = this.field_150861_f.posX + j * Direction.offsetX[BlockModPortal.field_150001_a[this.field_150865_b][1]]; - l = this.field_150861_f.posZ + j * Direction.offsetZ[BlockModPortal.field_150001_a[this.field_150865_b][1]]; - Block block = this.worldObj.getBlock(k, i, l); - - if (!this.getBlockMaterial(block)) - { - break label56; - } - - if (block == ModBlocks.lightPortal) - { - ++this.field_150864_e; - } - - if (j == 0) - { - block = this.worldObj.getBlock(k + Direction.offsetX[BlockModPortal.field_150001_a[this.field_150865_b][0]], i, l + Direction.offsetZ[BlockModPortal.field_150001_a[this.field_150865_b][0]]); - - if (block != Blocks.stone) - { - break label56; - } - } - else if (j == this.field_150868_h - 1) - { - block = this.worldObj.getBlock(k + Direction.offsetX[BlockModPortal.field_150001_a[this.field_150865_b][1]], i, l + Direction.offsetZ[BlockModPortal.field_150001_a[this.field_150865_b][1]]); - - if (block != Blocks.stone) - { - break label56; - } - } - } - } - - for (i = 0; i < this.field_150868_h; ++i) - { - j = this.field_150861_f.posX + i * Direction.offsetX[BlockModPortal.field_150001_a[this.field_150865_b][1]]; - k = this.field_150861_f.posY + this.field_150862_g; - l = this.field_150861_f.posZ + i * Direction.offsetZ[BlockModPortal.field_150001_a[this.field_150865_b][1]]; - - if (this.worldObj.getBlock(j, k, l) != Blocks.stone) - { - this.field_150862_g = 0; - break; - } - } - - if (this.field_150862_g <= 21 && this.field_150862_g >= 3) - { - return this.field_150862_g; - } - else - { - this.field_150861_f = null; - this.field_150868_h = 0; - this.field_150862_g = 0; - return 0; - } - } - - protected boolean getBlockMaterial(Block block){ - return block.getMaterial() == Material.air || block == ModBlocks.blockHellfire || block == ModBlocks.lightPortal; - } - - public boolean func_150860_b() - { - return this.field_150861_f != null && this.field_150868_h >= 2 && this.field_150868_h <= 21 && this.field_150862_g >= 3 && this.field_150862_g <= 21; - } - - public void func_150859_c() - { - for (int i = 0; i < this.field_150868_h; ++i) - { - int j = this.field_150861_f.posX + Direction.offsetX[this.field_150866_c] * i; - int k = this.field_150861_f.posZ + Direction.offsetZ[this.field_150866_c] * i; - - for (int l = 0; l < this.field_150862_g; ++l) - { - int i1 = this.field_150861_f.posY + l; - this.worldObj.setBlock(j, i1, k, ModBlocks.lightPortal, this.field_150865_b, 2); - } - } - } - } - - int blockColour = Utils.rgbtoHexValue(200, 50, 50); - - @Override - public int colorMultiplier(final IBlockAccess par1IBlockAccess, final int par2, final int par3, final int par4){ - - if (this.blockColour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.blockColour; - } - - @Override - public int getRenderColor(final int aMeta) { - if (this.blockColour == 0){ - return MathUtils.generateSingularRandomHexValue(); - } - return this.blockColour; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/particle/EntityTreeFX.java b/src/Java/gtPlusPlus/core/world/dimensionA/particle/EntityTreeFX.java deleted file mode 100644 index f9b471f0d4..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/particle/EntityTreeFX.java +++ /dev/null @@ -1,103 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.particle; - -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.world.World; - -public class EntityTreeFX extends EntityFX{ - - //TODO: add abailty to change particle color in constructor. - - private float portalParticleScale; - private double portalPosX; - private double portalPosY; - private double portalPosZ; - - @SuppressWarnings("unused") - private static final String __OBFID = "CL_000003921"; - - public EntityTreeFX(World world, double posX, double posY, double posZ, double motionPosX, double motionPosY, double motionPosZ) - { - - super(world, posX, posY, posZ, motionPosX, motionPosY, motionPosZ); - this.motionX = motionPosX; - this.motionY = motionPosY; - this.motionZ = motionPosZ; - this.portalPosX = this.posX = posX; - this.portalPosY = this.posY = posY; - this.portalPosZ = this.posZ = posZ; - this.portalParticleScale = this.particleScale = this.rand.nextFloat() * 0.2F + 0.5F; - this.particleRed = 0.0F; - this.particleGreen = 0.0F; - this.particleBlue = 1.0F; - this.particleMaxAge = (int)(Math.random() * 10.0D) + 40; - this.noClip = true; - this.setParticleTextureIndex((int)(Math.random() * 8.0D)); - } - - @Override - public void renderParticle(Tessellator tessellator, float posX, float posY, float posZ, float movePosX, float movePosY, float movePosZ) - { - float f6 = (this.particleAge + posX) / this.particleMaxAge; - f6 = 1.0F - f6; - f6 *= f6; - f6 = 1.0F - f6; - this.particleScale = this.portalParticleScale * f6; - super.renderParticle(tessellator, posX, posY, posZ, movePosX, movePosY, movePosZ); - } - - @Override - public int getBrightnessForRender(float amount) - { - int i = super.getBrightnessForRender(amount); - float f1 = (float)this.particleAge / (float)this.particleMaxAge; - f1 *= f1; - f1 *= f1; - int j = i & 255; - int k = i >> 16 & 255; - k += (int)(f1 * 15.0F * 16.0F); - - if (k > 240) - { - k = 240; - } - - return j | k << 16; - } - - /** - * Gets how bright this entity is. - */ - @Override - public float getBrightness(float amount) - { - float f1 = super.getBrightness(amount); - float f2 = (float)this.particleAge / (float)this.particleMaxAge; - f2 = f2 * f2 * f2 * f2; - return f1 * (1.0F - f2) + f2; - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() - { - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - float f = (float)this.particleAge / (float)this.particleMaxAge; - float f1 = f; - f = -f + f * f * 2.0F; - f = 1.0F - f; - this.posX = this.portalPosX + this.motionX * f; - this.posY = this.portalPosY + this.motionY * f + (1.0F - f1); - this.posZ = this.portalPosZ + this.motionZ * f; - - if (this.particleAge++ >= this.particleMaxAge) - { - this.setDead(); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/util/Dimension_A_Teleporter.java b/src/Java/gtPlusPlus/core/world/dimensionA/util/Dimension_A_Teleporter.java deleted file mode 100644 index d1159691d5..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/util/Dimension_A_Teleporter.java +++ /dev/null @@ -1,531 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.util; - -import java.util.*; - -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; -import net.minecraft.entity.Entity; -import net.minecraft.init.Blocks; -import net.minecraft.util.*; -import net.minecraft.world.*; - -public class Dimension_A_Teleporter extends Teleporter -{ - private final WorldServer worldServerInstance; - /** A private Random() function in Teleporter */ - private final XSTR 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(); - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000153"; - - public Dimension_A_Teleporter(WorldServer p_i1963_1_) - { - super(p_i1963_1_); - this.worldServerInstance = p_i1963_1_; - this.random = new XSTR(p_i1963_1_.getSeed()); - } - - /** - * Place an entity in a nearby portal, creating one if necessary. - */ - @Override - public void placeInPortal(Entity p_77185_1_, double p_77185_2_, double p_77185_4_, double p_77185_6_, float p_77185_8_) - { - if (this.worldServerInstance.provider.dimensionId != 1) - { - if (!this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_)) - { - this.makePortal(p_77185_1_); - this.placeInExistingPortal(p_77185_1_, p_77185_2_, p_77185_4_, p_77185_6_, p_77185_8_); - } - } - else - { - int i = MathHelper.floor_double(p_77185_1_.posX); - int j = MathHelper.floor_double(p_77185_1_.posY) - 1; - int k = MathHelper.floor_double(p_77185_1_.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 ? Blocks.stone : Blocks.air); - } - } - } - - p_77185_1_.setLocationAndAngles(i, j, k, p_77185_1_.rotationYaw, 0.0F); - p_77185_1_.motionX = p_77185_1_.motionY = p_77185_1_.motionZ = 0.0D; - } - } - - /** - * Place an entity in a nearby portal which already exists. - */ - @Override - @SuppressWarnings("unchecked") - public boolean placeInExistingPortal(Entity p_77184_1_, double p_77184_2_, double p_77184_4_, double p_77184_6_, float p_77184_8_) - { - short short1 = 128; - double d3 = -1.0D; - int i = 0; - int j = 0; - int k = 0; - int l = MathHelper.floor_double(p_77184_1_.posX); - int i1 = MathHelper.floor_double(p_77184_1_.posZ); - long j1 = ChunkCoordIntPair.chunkXZ2Int(l, i1); - boolean flag = true; - double d7; - int l3; - - if (this.destinationCoordinateCache.containsItem(j1)) - { - Dimension_A_Teleporter.PortalPosition portalposition = (Dimension_A_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 - p_77184_1_.posX; - - for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) - { - double d5 = l1 + 0.5D - p_77184_1_.posZ; - - for (int i2 = this.worldServerInstance.getActualHeight() - 1; i2 >= 0; --i2) - { - if (this.worldServerInstance.getBlock(l3, i2, l1) == ModBlocks.lightPortal) - { - while (this.worldServerInstance.getBlock(l3, i2 - 1, l1) == ModBlocks.lightPortal) - { - --i2; - } - - d7 = i2 + 0.5D - p_77184_1_.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 Dimension_A_Teleporter.PortalPosition(i, j, k, this.worldServerInstance.getTotalWorldTime())); - this.destinationCoordinateKeys.add(Long.valueOf(j1)); - System.out.println("Location " + 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) == ModBlocks.lightPortal) - { - i4 = 2; - } - - if (this.worldServerInstance.getBlock(i + 1, j, k) == ModBlocks.lightPortal) - { - i4 = 0; - } - - if (this.worldServerInstance.getBlock(i, j, k - 1) == ModBlocks.lightPortal) - { - i4 = 3; - } - - if (this.worldServerInstance.getBlock(i, j, k + 1) == ModBlocks.lightPortal) - { - i4 = 1; - } - - int j2 = p_77184_1_.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 = p_77184_1_.motionX; - double d10 = p_77184_1_.motionZ; - p_77184_1_.motionX = d9 * f3 + d10 * f6; - p_77184_1_.motionZ = d9 * f5 + d10 * f4; - p_77184_1_.rotationYaw = p_77184_8_ - j2 * 90 + i4 * 90; - } - else - { - p_77184_1_.motionX = p_77184_1_.motionY = p_77184_1_.motionZ = 0.0D; - } - - p_77184_1_.setLocationAndAngles(d11, d6, d7, p_77184_1_.rotationYaw, p_77184_1_.rotationPitch); - return true; - } - else - { - return false; - } - } - - @Override - public boolean makePortal(Entity p_85188_1_) - { - byte b0 = 16; - double d0 = -1.0D; - int i = MathHelper.floor_double(p_85188_1_.posX); - int j = MathHelper.floor_double(p_85188_1_.posY); - int k = MathHelper.floor_double(p_85188_1_.posZ); - int l = i; - int i1 = j; - int j1 = k; - int k1 = 0; - int l1 = this.random.nextInt(4); - int i2; - double d1; - int k2; - double d2; - int i3; - int j3; - int k3; - int l3; - int i4; - int j4; - int k4; - int l4; - int i5; - double d3; - double d4; - - for (i2 = i - b0; i2 <= i + b0; ++i2) - { - d1 = i2 + 0.5D - p_85188_1_.posX; - - for (k2 = k - b0; k2 <= k + b0; ++k2) - { - d2 = k2 + 0.5D - p_85188_1_.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; - } - } - } - } - - d3 = i3 + 0.5D - p_85188_1_.posY; - d4 = d1 * d1 + d3 * d3 + d2 * d2; - - if (d0 < 0.0D || d4 < d0) - { - d0 = d4; - 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 - p_85188_1_.posX; - - for (k2 = k - b0; k2 <= k + b0; ++k2) - { - d2 = k2 + 0.5D - p_85188_1_.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; - } - } - } - - d3 = i3 + 0.5D - p_85188_1_.posY; - d4 = d1 * d1 + d3 * d3 + d2 * d2; - - if (d0 < 0.0D || d4 < d0) - { - d0 = d4; - 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 ? Blocks.stone : 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 ? Blocks.stone : ModBlocks.lightPortal, 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 p_85189_1_) - { - if (p_85189_1_ % 100L == 0L) - { - @SuppressWarnings("rawtypes") - Iterator iterator = this.destinationCoordinateKeys.iterator(); - long j = p_85189_1_ - 600L; - - while (iterator.hasNext()) - { - Long olong = (Long)iterator.next(); - Dimension_A_Teleporter.PortalPosition portalposition = (Dimension_A_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; - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000154"; - - public PortalPosition(int p_i1962_2_, int p_i1962_3_, int p_i1962_4_, long p_i1962_5_) - { - super(p_i1962_2_, p_i1962_3_, p_i1962_4_); - this.lastUpdateTime = p_i1962_5_; - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/util/Names.java b/src/Java/gtPlusPlus/core/world/dimensionA/util/Names.java deleted file mode 100644 index 2ad0dc3adb..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/util/Names.java +++ /dev/null @@ -1,10 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.util; - -/** - * Holds all names for biomes, blocks and items. - * @author Jimmy04Creeper - */ -public class Names { - - public static final String FORESTBIOMENAME = "Blue light Forest"; -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/util/ReadFile.java b/src/Java/gtPlusPlus/core/world/dimensionA/util/ReadFile.java deleted file mode 100644 index 73bfdbf705..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/util/ReadFile.java +++ /dev/null @@ -1,91 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.util; - -import java.io.*; - -public class ReadFile { - - private static int[] fileData; - - private static int numberOfLinesInFile; - - public static void findFileAndRead(String filePath){ - File file = new File(filePath); - if(file.exists() == true){ - System.out.println("file Found @ " + file.getAbsolutePath()); - try { - countLines(file); - } catch (IOException e) { - e.printStackTrace(); - } - readFileStrings(file); - }else{ - System.out.println("Can not find File"); - } - } - - /** - * Count the Nukber of Lnes in the file. - * @param file - * @return int numberOfLines - * @throws IOException - */ - private static int countLines(File file) throws IOException{ - FileReader reader = new FileReader(file); - BufferedReader buffedreader = new BufferedReader(reader); - @SuppressWarnings("unused") - String aLine; - numberOfLinesInFile = 0; - while((aLine = buffedreader.readLine()) != null){ - numberOfLinesInFile++; - } - buffedreader.close(); - return numberOfLinesInFile; - } - - /** - * Reads a File as Strings. - */ - public static void readFileStrings(File file){ - try { - FileReader reader = new FileReader(file); - BufferedReader buffedreader = new BufferedReader(reader); - String[] fileData = new String[numberOfLinesInFile]; - for(int i = 0; i < numberOfLinesInFile; i++){ - fileData[i] = buffedreader.readLine(); - System.out.println(fileData[i]); - } - reader.close(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** - * Reads a File as ints. - */ - public static void readFileInts(File file){ - try { - FileReader reader = new FileReader(file); - BufferedReader buffedreader = new BufferedReader(reader); - - fileData = new int[numberOfLinesInFile]; - for(int i = 0; i < numberOfLinesInFile; i++){ - int inits = Integer.parseInt(buffedreader.readLine()); - fileData[i] = inits; - System.out.println(fileData[i]); - } - reader.close(); - } catch (FileNotFoundException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - } - - /** Get ints from the file **/ - public static int[] getIntList(){ - return fileData; - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/ChunkProviderForest.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/ChunkProviderForest.java deleted file mode 100644 index d6dd8e0222..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/ChunkProviderForest.java +++ /dev/null @@ -1,489 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world; - -import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.*; -import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.*; - -import java.util.List; - -import cpw.mods.fml.common.eventhandler.Event.Result; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.world.dimensionA.world.biomes.ModBiomes; -import gtPlusPlus.xmod.gregtech.api.objects.XSTR; -import gtPlusPlus.xmod.thermalfoundation.block.TF_Blocks; -import net.minecraft.block.Block; -import net.minecraft.block.BlockFalling; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.init.Blocks; -import net.minecraft.util.IProgressUpdate; -import net.minecraft.util.MathHelper; -import net.minecraft.world.*; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.*; -import net.minecraft.world.gen.feature.WorldGenDungeons; -import net.minecraft.world.gen.feature.WorldGenLakes; -import net.minecraft.world.gen.structure.MapGenScatteredFeature; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.terraingen.*; - -public class ChunkProviderForest implements IChunkProvider { - - /** RNG. */ - private XSTR rand; - - /** A NoiseGeneratorOctaves used in generating terrain */ - private NoiseGeneratorOctaves noiseGen1; - private NoiseGeneratorOctaves noiseGen2; - private NoiseGeneratorOctaves noiseGen3; - private NoiseGeneratorPerlin noisePerl; - - /** 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; - - /** are map structures going to be generated (e.g. strongholds) */ - private final boolean mapFeaturesEnabled; - - private WorldType worldType; - private final double[] noiseArray; - private final float[] parabolicField; - private double[] stoneNoise = new double[256]; - private MapGenBase caveGenerator = new MapGenCaves(); - - 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; - - /** A double array that hold terrain noise */ - double[] noise3; - double[] noise1; - double[] noise2; - double[] noise5; - int[][] field_73219_j = new int[32][32]; - - { - caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE); - scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE); - ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE); - } - - public ChunkProviderForest(World world, long seed, boolean mapFeaturesEnabled) - { - Utils.LOG_INFO("Loading Chunk Provider for dimension."); - this.worldObj = world; - this.mapFeaturesEnabled = false; - this.worldType = world.getWorldInfo().getTerrainType(); - this.rand = new XSTR(seed); - this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16); - this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16); - this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 8); - this.noisePerl = 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.noiseArray = 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 = {noiseGen1, noiseGen2, noiseGen3, noisePerl, noiseGen5, noiseGen6, mobSpawnerNoise}; - noiseGens = TerrainGen.getModdedNoiseGenerators(world, this.rand, noiseGens); - this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0]; - this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1]; - this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2]; - this.noisePerl = (NoiseGeneratorPerlin)noiseGens[3]; - this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4]; - this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5]; - this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6]; - } - - /** - * Generates the shape of the terrain for the chunk though its all stone - * though the water is frozen if the temperature is low enough - */ - // TODO: generateTerrain? - public void func_147424_a(int par1, int par2, Block[] blocks) { - - //DONT EDIT THS METHOD UNLES YOU KNOW WHAT UR DOING OR MAKE A COPY INCASE U MESS IT UP.... - //YOU HAVE BE WARNED !!!!! - - byte b0 = 63; - this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, 10, 10); - this.func_147423_a(par1 * 4, 0, par2 * 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.noiseArray[k1 + k2]; - double d2 = this.noiseArray[l1 + k2]; - double d3 = this.noiseArray[i2 + k2]; - double d4 = this.noiseArray[j2 + k2]; - double d5 = (this.noiseArray[k1 + k2 + 1] - d1) * d0; - double d6 = (this.noiseArray[l1 + k2 + 1] - d2) * d0; - double d7 = (this.noiseArray[i2 + k2 + 1] - d3) * d0; - double d8 = (this.noiseArray[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) { - blocks[j3 += short1] = Blocks.stone;//these can be set to custom blocks - } else if (k2 * 8 + l2 < b0) { - blocks[j3 += short1] = TF_Blocks.blockFluidEnder;//these can be set to custom blocks - } else { - blocks[j3 += short1] = null;//this is the air block i think. - } - } - d10 += d12; - d11 += d13; - } - d1 += d5; - d2 += d6; - d3 += d7; - d4 += d8; - } - } - } - } - } - - public void replaceBlocksForBiome(int par1, int par2, Block[] blocks, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) { - //Utils.LOG_INFO("Replacing block for biome."); - @SuppressWarnings("deprecation") - ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, blocks, par3ArrayOfByte, par4ArrayOfBiomeGenBase); - MinecraftForge.EVENT_BUS.post(event); - if (event.getResult() == Result.DENY) return; - double d0 = 0.03125D; - this.stoneNoise = this.noisePerl.func_151599_a(this.stoneNoise, par1 * 16, par2 * 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) { - ModBiomes biomegenbase = (ModBiomes) par4ArrayOfBiomeGenBase[l + k * 16]; - biomegenbase.genTerrainBlocks(this.worldObj, this.rand, blocks, par3ArrayOfByte, par1 * 16 + k, par2 * 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); - this.caveGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock); - this.ravineGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock); - if (this.mapFeaturesEnabled) { - this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock); - } - 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; - } - - /** - * generates a subset of the level's terrain data. Takes 7 arguments: the - * [empty] noise array, the position, and the size. - */ - // TODO: initializeNoiseField? - private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_) { - - //DONT EDIT THS METHOD UNLES YOU KNOW WHAT UR DOING OR MAKE A COPY INCASE U MESS IT UP.... - //YOU HAVE BE WARNED !!!!! - - this.noise5 = this.noiseGen6.generateNoiseOctaves(this.noise5, p_147423_1_, p_147423_3_, 5, 5, 200.0D, 200.0D, 0.5D); - this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D); - this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D); - this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, 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.worldType == 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 d12 = this.noise5[i1] / 8000.0D; - if (d12 < 0.0D) { - d12 = -d12 * 0.3D; - } - d12 = d12 * 3.0D - 2.0D; - if (d12 < 0.0D) { - d12 /= 2.0D; - if (d12 < -1.0D) { - d12 = -1.0D; - } - d12 /= 1.4D; - d12 /= 2.0D; - } else { - if (d12 > 1.0D) { - d12 = 1.0D; - } - d12 /= 8.0D; - } - ++i1; - double d13 = f1; - double d14 = f; - d13 += d12 * 0.2D; - d13 = d13 * 8.5D / 8.0D; - double d5 = 8.5D + d13 * 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.noise1[l] / 512.0D; - double d8 = this.noise2[l] / 512.0D; - double d9 = (this.noise3[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.noiseArray[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)); - - //Enable map features ?? - if (this.mapFeaturesEnabled) { - this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3); - } - int k1; - int l1; - int i2; - - //Add Cryotheum Lakes - if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0 - && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE)) { - k1 = k + this.rand.nextInt(16) + 8; - l1 = this.rand.nextInt(256); - i2 = l + this.rand.nextInt(16) + 8; - (new WorldGenLakes(TF_Blocks.blockFluidCryotheum)).generate(this.worldObj, this.rand, k1, l1, i2); - } - - //Add Pyrotheum Lakes - if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) { - k1 = k + this.rand.nextInt(16) + 8; - l1 = this.rand.nextInt(this.rand.nextInt(248) + 8); - i2 = l + this.rand.nextInt(16) + 8; - - if (l1 < 63 || this.rand.nextInt(10) == 0) { - (new WorldGenLakes(TF_Blocks.blockFluidPyrotheum)).generate(this.worldObj, this.rand, k1, l1, i2); - } - } - - //Add Ender Lakes - if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) { - k1 = k + this.rand.nextInt(16) + 8; - l1 = this.rand.nextInt(this.rand.nextInt(248) + 8); - i2 = l + this.rand.nextInt(16) + 8; - - if (l1 < 63 || this.rand.nextInt(10) == 0) { - (new WorldGenLakes(TF_Blocks.blockFluidEnder)).generate(this.worldObj, this.rand, k1, l1, i2); - } - } - - //Add Dungeons ?? - boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON); - for (k1 = 0; doGen && k1 < 8; ++k1) { - l1 = k + this.rand.nextInt(16) + 8; - i2 = this.rand.nextInt(256); - int j2 = l + this.rand.nextInt(16) + 8; - (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2); - } - - //Add Animals ?? - biomegenbase.decorate(this.worldObj, this.rand, k, l); - if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) { - SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand); - } - k += 8; - l += 8; - - //Creates snow and ice in world. - doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE); - for (k1 = 0; doGen && k1 < 16; ++k1) { - for (l1 = 0; l1 < 16; ++l1) { - i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1); - - if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) { - this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2); - } - - if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) { - this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2); - } - } - } - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag)); - BlockFalling.fallInstantly = false; - } - - /** - * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks. - * Return true if all chunks have been saved. - */ - @Override - public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { - return true; - } - - /** - * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently - * unimplemented. - */ - @Override - public void saveExtraData() {} - - /** - * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. - */ - @Override - public boolean unloadQueuedChunks() { - return false; - } - - /** - * Returns if the IChunkProvider supports saving. - */ - @Override - public boolean canSave() { - return true; - } - - /** - * Converts the instance data to a readable string. - */ - @Override - public String makeString() { - return "RandomLevelSource"; - } - - /** - * Returns a list of creatures of the specified type that can spawn at the given location. - */ - @SuppressWarnings("rawtypes") - @Override - public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) { - BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4); - return par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.func_143030_a(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType); - } - - @Override - public int getLoadedChunkCount() { - return 0; - } - - @Override - public void recreateStructures(int par1, int par2) { - if (this.mapFeaturesEnabled) { - //this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null); - } - } - - /** - * Returns the location of the closest structure of the specified type. If - * not found returns null. - */ - @Override - // TODO: findClosestStructure - public ChunkPosition func_147416_a(World world, String arg1, int arg2, int arg3, int arg4) { - return null; - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/Dimension.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/Dimension.java deleted file mode 100644 index d65b7e9a92..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/Dimension.java +++ /dev/null @@ -1,22 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world; - -import gtPlusPlus.core.world.DimensionIDs; -import net.minecraftforge.common.DimensionManager; - -public class Dimension { - - /** - * Register dimensions. - * @param register - */ - public static void registerDimensions(){ - DimensionManager.registerDimension(DimensionIDs.Dimension_A, DimensionIDs.Dimension_A); - } - - /** - * Regster dimension world providers with the dimension manager. - */ - public static void registerWorldProvider(){ - DimensionManager.registerProviderType(DimensionIDs.Dimension_A, WorldProviderForest.class, true); - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/WorldChunkManagerForest.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/WorldChunkManagerForest.java deleted file mode 100644 index 9808d4c2d4..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/WorldChunkManagerForest.java +++ /dev/null @@ -1,288 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world; - -import java.util.*; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.world.dimensionA.world.genlayer.LightForestGenLayer; -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.util.ReportedException; -import net.minecraft.world.*; -import net.minecraft.world.biome.*; -import net.minecraft.world.gen.layer.GenLayer; -import net.minecraft.world.gen.layer.IntCache; - -public class WorldChunkManagerForest 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({ "unchecked", "rawtypes" }) - public WorldChunkManagerForest() - { - this.biomeCache = new BiomeCache(this); - this.biomesToSpawnIn = new ArrayList(); - this.biomesToSpawnIn.addAll(allowedBiomes); - } - - public WorldChunkManagerForest(long seed, WorldType worldType) - { - this(); - // i changed this to my GenLayerTutorial - GenLayer[] agenlayer = LightForestGenLayer.makeTheWorld(seed, worldType); - agenlayer = getModdedBiomeGenerators(worldType, seed, agenlayer); - this.genBiomes = agenlayer[0]; - this.biomeIndexLayer = agenlayer[1]; - } - - public WorldChunkManagerForest(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 the BiomeGenBase related to the x, z position on the world. - */ - @Override - public BiomeGenBase getBiomeGenAt(int x, int z) - { - return this.biomeCache.getBiomeGenAt(x, z); - } - - /** - * 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 x, int y, int z, List par4List, Random random) - { - 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); - 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 (par4List.contains(biomegenbase) && (chunkposition == null || random.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/Java/gtPlusPlus/core/world/dimensionA/world/WorldProviderForest.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/WorldProviderForest.java deleted file mode 100644 index e543391a70..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/WorldProviderForest.java +++ /dev/null @@ -1,217 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gtPlusPlus.core.world.DimensionIDs; -import gtPlusPlus.core.world.dimensionA.world.renderers.*; -import net.minecraft.entity.Entity; -import net.minecraft.util.*; -import net.minecraft.world.World; -import net.minecraft.world.WorldProvider; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraftforge.client.IRenderHandler; -import net.minecraftforge.common.DimensionManager; - -public class WorldProviderForest extends WorldProvider{ - - @Override - /** tells Minecraft to use our new Terrain Generator */ - public IChunkProvider createChunkGenerator() { - return new ChunkProviderForest(this.worldObj, this.worldObj.getSeed(), true); - } - - @Override - /** tells Minecraft to use our new WorldChunkManager **/ - public void registerWorldChunkManager() { - this.worldChunkMgr = new WorldChunkManagerForest(worldObj.getSeed(), terrainType); - this.dimensionId = DimensionIDs.Dimension_A; - } - - /** Get Provider for Dimension **/ - public static WorldProvider getProviderForDimension(int id) - { - return DimensionManager.createProviderFor(DimensionIDs.Dimension_A); - } - - @Override - /** - * @return the name of the dimension - */ - public String getDimensionName() { - return "Light Forest"; - } - - @Override - /** sets/creates the save folder */ - public String getSaveFolder() { - return "DIM" + DimensionIDs.Dimension_A; - } - - @SideOnly(Side.CLIENT) - /** should stars be rendered? */ - public boolean renderStars() { - return true; - } - - @Override - @SideOnly(Side.CLIENT) - /** @return the player speed */ - public double getMovementFactor() { - return 0.1; - } - - @SideOnly(Side.CLIENT) - /** @return the light value of the stars*/ - public float getStarBrightness(World world, float f) { - return 1.0F; - } - - @SideOnly(Side.CLIENT) - /** should clouds be rendered? */ - public boolean renderClouds() { - return true; - } - - @SideOnly(Side.CLIENT) - public boolean renderVoidFog() { - return false; - } - - @SideOnly(Side.CLIENT) - /** should the end sky be rendered or the overworld sky? */ - public boolean renderEndSky() { - return true; - } - - @SideOnly(Side.CLIENT) - /** @return the size of the sun */ - public float setSunSize() { - return 0.5F; - } - - @SideOnly(Side.CLIENT) - /** @return the size of the moon */ - public float setMoonSize() { - return 4.0F; - } - - @Override - @SideOnly(Side.CLIENT) - /** - * @return the sky color - */ - public Vec3 getSkyColor(Entity cameraEntity, float partialTicks) { - return worldObj.getSkyColorBody(cameraEntity, partialTicks); - } - - @Override - @SideOnly(Side.CLIENT) - /** should a color for the sky be rendered? */ - public boolean isSkyColored() - { - return true; - } - - @Override - /** can the player respawn in this dimension? */ - public boolean canRespawnHere() - { - return true; - } - - @Override - /** is this a surface world or an underworld */ - public boolean isSurfaceWorld() - { - return true; - } - - @Override - @SideOnly(Side.CLIENT) - /** @return the high of the clouds */ - public float getCloudHeight() - { - return this.terrainType.getCloudHeight(); - } - - @Override - public ChunkCoordinates getEntrancePortalLocation() - { - return new ChunkCoordinates(50, 5, 0); - } - - @Override - /** the light value in this dimension */ - protected void generateLightBrightnessTable() - { - float f = 0.0F; - - for (int i = 0; i <= 15; ++i) - { - float f1 = 1.0F - i / 15.0F; - this.lightBrightnessTable[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * (1.0F - f) + f; - } - } - - @Override - @SideOnly(Side.CLIENT) - /** @return the dimension join message */ - public String getWelcomeMessage() - { - return "Entering the Forest"; - } - - @Override - @SideOnly(Side.CLIENT) - /** @return the dimension leave message */ - public String getDepartMessage() - { - return "Leaving the Forest"; - } - - @Override - public IRenderHandler getSkyRenderer() { - return new SkyRenderer(); - } - - @Override - public IRenderHandler getCloudRenderer() { - return new CloudRenderer(); - } - - @Override - public IRenderHandler getWeatherRenderer() { - return new WeatherRenderer(); - } - - @Override - public Vec3 drawClouds(float partialTicks) { - // TODO Auto-generated method stub - return super.drawClouds(partialTicks); - } - - @Override - @SideOnly(Side.CLIENT) - public Vec3 getFogColor(float par1, float par2) - { - float f2 = MathHelper.cos(par1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F; - - if (f2 < 0.0F) - { - f2 = 0.0F; - } - - if (f2 > 1.0F) - { - f2 = 1.0F; - } - - float f3 = 0.7529412F; - float f4 = 0.84705883F; - float f5 = 1.0F; - f3 *= f2 * 0.94F + 0.06F; - f4 *= f2 * 0.94F + 0.06F; - f5 *= f2 * 0.91F + 0.09F; - return Vec3.createVectorHelper(f3, f4, f5); - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/WorldTypesTutorial.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/WorldTypesTutorial.java deleted file mode 100644 index 722ca4c2f3..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/WorldTypesTutorial.java +++ /dev/null @@ -1,59 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import net.minecraft.world.World; -import net.minecraft.world.WorldType; -import net.minecraft.world.biome.*; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderGenerate; - -public class WorldTypesTutorial extends WorldType{ - - private boolean hasNotificationData; - - public static WorldType tutDimOverWorld; - - public WorldTypesTutorial(String name) { - super(name); - } - - public static void addCustomWorldTypes(){ - tutDimOverWorld = new WorldTypesTutorial("TUTORIAL").setNotificationData(); - } - - @Override - public WorldChunkManager getChunkManager(World world) { - return new WorldChunkManagerHell(BiomeGenBase.megaTaiga, 0.5F); - } - - @Override - public IChunkProvider getChunkGenerator(World world, String generatorOptions) { - return new ChunkProviderGenerate(world, world.getSeed(), world.getWorldInfo().isMapFeaturesEnabled()); - } - - @Override - public int getMinimumSpawnHeight(World world) { - return 64; - } - - /** - * enables the display of generator.[worldtype].info message on the customize world menu - */ - private WorldType setNotificationData() - { - this.hasNotificationData = true; - return this; - } - - /** - * returns true if selecting this worldtype from the customize menu should display the generator.[worldtype].info - * message - */ - @SideOnly(Side.CLIENT) - @Override - public boolean showWorldInfoNotice() - { - return this.hasNotificationData; - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeDarkForest.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeDarkForest.java deleted file mode 100644 index 9167189bcc..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeDarkForest.java +++ /dev/null @@ -1,48 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.biomes; - -import java.util.Random; - -import gtPlusPlus.core.world.dimensionA.world.biomes.decorators.BiomeDecoratorMod; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenTallGrass; -import net.minecraft.world.gen.feature.WorldGenerator; - -public class BiomeDarkForest extends ModBiomes{ - - protected BiomeDecoratorMod decorator; - - public BiomeDarkForest(int biomeId) { - super(biomeId); - this.theBiomeDecorator.treesPerChunk = 30; - this.theBiomeDecorator.grassPerChunk = 5; - this.theBiomeDecorator.flowersPerChunk = 1; - - this.topBlock = Blocks.grass; - this.fillerBlock = Blocks.dirt; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random random){ - return random.nextInt(2) == 0 ? new WorldGenTallGrass(Blocks.tallgrass, 1) : new WorldGenTallGrass(Blocks.tallgrass, 2); - } - - /** - * Remove this to remove vines from dimension - */ - @Override - public void decorate(World world, Random random, int par3, int par4) { - super.decorate(world, random, par3, par4); -// WorldGenVines worldgenvines = new WorldGenVines(); -// -// for (int k = 0; k < 50; ++k) { -// int l = par3 + random.nextInt(16) + 8; -// byte b0 = 64; -// int i1 = par4 + random.nextInt(16) + 8; -// worldgenvines.generate(world, random, l, b0, i1); -// } - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeIDs.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeIDs.java deleted file mode 100644 index 4e15fb9cf3..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeIDs.java +++ /dev/null @@ -1,8 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.biomes; - -public class BiomeIDs { - - public static int LIGHT; - public static int DARK; - public static int BLUE; -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeLightForest.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeLightForest.java deleted file mode 100644 index 5891a4fc2f..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/BiomeLightForest.java +++ /dev/null @@ -1,47 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.biomes; - -import java.util.Random; - -import gtPlusPlus.core.world.dimensionA.world.biomes.decorators.BiomeDecoratorMod; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenTallGrass; -import net.minecraft.world.gen.feature.WorldGenerator; - -public class BiomeLightForest extends ModBiomes{ - - public static int treesPerChunk; - - protected BiomeDecoratorMod decorator; - - public BiomeLightForest(int biomeId) { - super(biomeId); - BiomeLightForest.treesPerChunk = 2; - this.topBlock = Blocks.grass; - this.fillerBlock = Blocks.dirt; - } - - /** - * Gets a WorldGen appropriate for this biome. - */ - @Override - public WorldGenerator getRandomWorldGenForGrass(Random random){ - return random.nextInt(2) == 0 ? new WorldGenTallGrass(Blocks.tallgrass, 1) : new WorldGenTallGrass(Blocks.tallgrass, 2); - } - - /** - * Remove this to remove vines from dimension - */ - @Override - public void decorate(World world, Random random, int par3, int par4) { - super.decorate(world, random, par3, par4); -// WorldGenVines worldgenvines = new WorldGenVines(); -// -// for (int k = 0; k < 50; ++k) { -// int l = par3 + random.nextInt(16) + 8; -// byte b0 = 64; -// int i1 = par4 + random.nextInt(16) + 8; -// worldgenvines.generate(world, random, l, b0, i1); -// } - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/ModBiomes.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/ModBiomes.java deleted file mode 100644 index 596723d33c..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/ModBiomes.java +++ /dev/null @@ -1,165 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.biomes; - -import java.util.Random; - -import gtPlusPlus.core.world.dimensionA.world.biomes.decorators.BiomeDecoratorMod; -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.gen.feature.WorldGenTallGrass; -import net.minecraft.world.gen.feature.WorldGenerator; -import net.minecraftforge.common.BiomeDictionary; -import net.minecraftforge.common.BiomeDictionary.Type; - -/** - * TutorialBiomes.class Holds and loads all Tutorial Biomes. - * - * @author Jimmy04Creeper - */ -public class ModBiomes extends BiomeGenBase { - - /** The biome height */ - public static final BiomeGenBase.Height biomeHeight = new BiomeGenBase.Height(0.3F, 0.6F); - - public static BiomeGenBase forestLight; - public static BiomeGenBase forestDark; - - public ModBiomes(int biomeId) { - super(biomeId); - this.theBiomeDecorator = new BiomeDecoratorMod(); - } - - static { - forestLight = (new BiomeLightForest(BiomeIDs.LIGHT).setColor(5470985).setTemperatureRainfall(0.95F, 0.9F).setHeight(biomeHeight).setBiomeName("Forest Of Light")); - forestDark = (new BiomeDarkForest(BiomeIDs.DARK).setColor(34049320).setTemperatureRainfall(0.8F, 0.4F).setHeight(biomeHeight).setBiomeName("Darkness Forest")); - } - - @Override - public WorldGenerator getRandomWorldGenForGrass(Random random) - { - if (random.nextInt(4) == 0) - return new WorldGenTallGrass(Blocks.tallgrass, 2); - else - return new WorldGenTallGrass(Blocks.tallgrass, 1); - } - - public static void registerWithBiomeDictionary() - { - BiomeDictionary.registerBiomeType(forestLight, Type.FOREST); - BiomeDictionary.registerBiomeType(forestDark, Type.SAVANNA); - BiomeDictionary.registerAllBiomes(); - } - - @Override - public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_) { - genBiomeModdedTerrain(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_); - } - - /** - * Replaces custom Stone to allow top/filler blocks to work in dimension. - * - * @param world - * @param random - * @param replacableBlock - * @param aByte - * @param x - * @param y - * @param z - */ - public void genBiomeModdedTerrain(World world, Random random, Block[] replacableBlock, byte[] aByte, int x, int y, double z) - { - Block block = this.topBlock; - byte b0 = (byte) (this.field_150604_aj & 255); - Block block1 = this.fillerBlock; - int k = -1; - int l = (int) (z / 3.0D + 3.0D + random.nextDouble() * 0.25D); - int i1 = x & 15; - int j1 = y & 15; - int k1 = replacableBlock.length / 256; - for (int l1 = 255; l1 >= 0; --l1) - { - int i2 = (j1 * 16 + i1) * k1 + l1; - - if (l1 <= 0 + random.nextInt(5)) - { - replacableBlock[i2] = Blocks.bedrock; - } - else - { - Block block2 = replacableBlock[i2]; - - if (block2 != null && block2.getMaterial() != Material.air) - { - if (block2 == Blocks.stone) - { - if (k == -1) - { - if (l <= 0) - { - block = null; - b0 = 0; - block1 = Blocks.stone; - } - else if (l1 >= 59 && l1 <= 64) - { - block = this.topBlock; - b0 = (byte) (this.field_150604_aj & 255); - block1 = this.fillerBlock; - } - - if (l1 < 63 && (block == null || block.getMaterial() == Material.air)) - { - if (this.getFloatTemperature(x, l1, y) < 0.15F) - { - block = Blocks.ice; - b0 = 0; - } - else - { - block = Blocks.water; - b0 = 0; - } - } - - k = l; - - if (l1 >= 62) - { - replacableBlock[i2] = block; - aByte[i2] = b0; - } - else if (l1 < 56 - l) - { - block = null; - block1 = Blocks.stone; - replacableBlock[i2] = Blocks.gravel; - } - else - { - replacableBlock[i2] = block1; - } - } - else if (k > 0) - { - --k; - replacableBlock[i2] = block1; - - if (k == 0 && block1 == Blocks.sand) - { - k = random.nextInt(4) + Math.max(0, l1 - 63); - block1 = Blocks.sandstone; - } - } - } - } - else - { - k = -1; - } - } - } - } - -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/decorators/BiomeDecoratorHelper.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/decorators/BiomeDecoratorHelper.java deleted file mode 100644 index d45f5e0256..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/decorators/BiomeDecoratorHelper.java +++ /dev/null @@ -1,102 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.biomes.decorators; - -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.world.dimensionA.world.biomes.ModBiomes; -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.gen.feature.WorldGenMinable; -import net.minecraft.world.gen.feature.WorldGenerator; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.terraingen.DecorateBiomeEvent; - -public class BiomeDecoratorHelper { - - private static WorldGenerator Fluorite; - - public BiomeDecoratorHelper(){ - // glowStone = new WorldGenMinable(Blocks.glowstone, 30, Blockss.lightStone); - } - - protected static void decorateBiome(BiomeGenBase biome) { - MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(BiomeDecoratorMod.currentWorld, BiomeDecoratorMod.randomGenerator, BiomeDecoratorMod.chunk_X, BiomeDecoratorMod.chunk_Z)); - //perpere ores for generation - initOres(); - //GenerateOres - generateOreInBiome(biome); - - if(biome == ModBiomes.forestLight || biome == ModBiomes.forestDark){ - BiomeDecoratorMod.howMenyTrees = 20; - int i = BiomeDecoratorMod.howMenyTrees; - /** Chunk Postions **/ - int chunkX; - int chunkZ; - int y; - /** get blocks at the given locations **/ - Block block; - Block blockA; - /** Generates Small tree **/ - for(int a = 0; a < i; ++a){ - if(i == BiomeDecoratorMod.randomGenerator.nextInt(8)){ - chunkX = BiomeDecoratorMod.chunk_X + BiomeDecoratorMod.randomGenerator.nextInt(16) + 8; - chunkZ = BiomeDecoratorMod.chunk_Z + BiomeDecoratorMod.randomGenerator.nextInt(16) + 8; - y = BiomeDecoratorMod.currentWorld.getTopSolidOrLiquidBlock(chunkX, chunkZ); - block = BiomeDecoratorMod.currentWorld.getBlock(chunkX, y, chunkZ); - blockA = BiomeDecoratorMod.currentWorld.getBlock(chunkX, y - 1, chunkZ); - if(block != Blocks.air || block != Blocks.water){ - if(blockA != Blocks.air || blockA != Blocks.water){ - BiomeDecoratorMod.smallTree.generate(BiomeDecoratorMod.currentWorld, BiomeDecoratorMod.randomGenerator, chunkX, y, chunkZ); - } - } - } - /** Generates Big tree **/ - if(i == BiomeDecoratorMod.randomGenerator.nextInt(15)){ - chunkX = BiomeDecoratorMod.chunk_X + BiomeDecoratorMod.randomGenerator.nextInt(16) + 8; - chunkZ = BiomeDecoratorMod.chunk_Z + BiomeDecoratorMod.randomGenerator.nextInt(16) + 8; - y = BiomeDecoratorMod.currentWorld.getTopSolidOrLiquidBlock(chunkX, chunkZ); - block = BiomeDecoratorMod.currentWorld.getBlock(chunkX, y, chunkZ); - blockA = BiomeDecoratorMod.currentWorld.getBlock(chunkX, y - 1, chunkZ); - if(block != Blocks.air || block != Blocks.water){ - if(blockA != Blocks.air || blockA != Blocks.water){ - BiomeDecoratorMod.bigTree.generate(BiomeDecoratorMod.currentWorld, BiomeDecoratorMod.randomGenerator, chunkX, y, chunkZ); - } - } - } - } - } - } - - /** - * Prepare ores for generation - */ - private static void initOres() { - //glowstone used fotr testing generation - Fluorite = new WorldGenMinable(ModBlocks.blockOreFluorite, 5, Blocks.stone); - } - - /** - * Geberate Ores In a Biome - * @param biome - */ - private static void generateOreInBiome(BiomeGenBase biome){ - if(biome == ModBiomes.forestLight || biome == ModBiomes.forestDark){ - genStandardOre(5, Fluorite, 0, 255); - } - } - - /** - * Generate ores in chunks. - * @param spawnWeight - * @param generatorToSpawn - * @param minSpawnHeight - * @param maxYSpawnHeight - */ - private static void genStandardOre(int spawnWeight, WorldGenerator generatorToSpawn, int minSpawnHeight, int maxYSpawnHeight) { - for (int l = 0; l < spawnWeight; ++l) { - int i1 = BiomeDecoratorMod.chunk_X + BiomeDecoratorMod.randomGenerator.nextInt(16); - int j1 = BiomeDecoratorMod.randomGenerator.nextInt(maxYSpawnHeight - minSpawnHeight) + minSpawnHeight; - int k1 = BiomeDecoratorMod.chunk_Z + BiomeDecoratorMod.randomGenerator.nextInt(16); - generatorToSpawn.generate(BiomeDecoratorMod.currentWorld, BiomeDecoratorMod.randomGenerator, i1, j1, k1); - } - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/decorators/BiomeDecoratorMod.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/decorators/BiomeDecoratorMod.java deleted file mode 100644 index 4c9b040e3a..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/biomes/decorators/BiomeDecoratorMod.java +++ /dev/null @@ -1,74 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.biomes.decorators; - -import java.util.Random; - -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.world.dimensionA.world.gen.*; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeDecorator; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.gen.feature.WorldGenMinable; - -public class BiomeDecoratorMod extends BiomeDecorator -{ - /** The world the BiomeDecorator is currently decorating */ - public static World currentWorld; - /** The Biome Decorator's random number generator. */ - public static Random randomGenerator; - /** The X-coordinate of the chunk currently being decorated */ - public static int chunk_X; - /** The Z-coordinate of the chunk currently being decorated */ - public static int chunk_Z; - /** True if decorator should generate surface lava & water */ - public static boolean generateLakes; - /** How meny trees per chunk, set in each biome class **/ - public static int howMenyTrees; - - /** Dimension Trees **/ - public static WorldGenForestTrees smallTree; - public static WorldGenForestBigTree bigTree; - public static WorldGenEffectTree effectTree; - - public BiomeDecoratorMod() { - coalGen = new WorldGenMinable(Blocks.coal_ore, 16, Blocks.stone); - ironGen = new WorldGenMinable(Blocks.iron_ore, 8, Blocks.stone); - goldGen = new WorldGenMinable(Blocks.gold_ore, 8, Blocks.stone); - redstoneGen = new WorldGenMinable(Blocks.redstone_ore, 7, Blocks.stone); - diamondGen = new WorldGenMinable(Blocks.diamond_ore, 7, Blocks.stone); - lapisGen = new WorldGenMinable(Blocks.lapis_ore, 6, Blocks.stone); - - // TREES - smallTree = new WorldGenForestTrees(true); - bigTree = new WorldGenForestBigTree(true, 10, 1, 5); - effectTree = new WorldGenEffectTree(true); - - // generates lakes and lava lakes in dimension. - generateLakes = true; - } - - @Override - public void decorateChunk(World world, Random random, BiomeGenBase biomeGenBase, int chunkX, int chunkZ) { - if (currentWorld != null) { - throw new RuntimeException("Already decorating!!"); - } else { - currentWorld = world; - randomGenerator = random; - chunk_X = chunkX; - chunk_Z = chunkZ; - genDecorationsForBiome(biomeGenBase); - currentWorld = null; - randomGenerator = null; - } - } - - /** - * Decorate's biome. - * - * @param biome - */ - protected void genDecorationsForBiome(BiomeGenBase biome) { - Utils.LOG_INFO("Decorating Chunk"); - BiomeDecoratorHelper.decorateBiome(biome); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenEffectTree.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenEffectTree.java deleted file mode 100644 index 7688bda41d..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenEffectTree.java +++ /dev/null @@ -1,212 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.gen; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.Direction; -import net.minecraft.world.World; -import net.minecraftforge.common.IPlantable; -import net.minecraftforge.common.util.ForgeDirection; - -public class WorldGenEffectTree extends WorldGenForestAbstractTree -{ - private Block log = Blocks.log; - private Block leaves = Blocks.leaves; - - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000432"; - - public WorldGenEffectTree(boolean p_i45463_1_) { - super(p_i45463_1_); - } - - @Override - public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) { - int l = p_76484_2_.nextInt(3) + p_76484_2_.nextInt(3) + 5; - boolean flag = true; - - if (p_76484_4_ >= 1 && p_76484_4_ + l + 1 <= 256) - { - int j1; - int k1; - - for (int i1 = p_76484_4_; i1 <= p_76484_4_ + 1 + l; ++i1) - { - byte b0 = 1; - - if (i1 == p_76484_4_) - { - b0 = 0; - } - - if (i1 >= p_76484_4_ + 1 + l - 2) - { - b0 = 2; - } - - for (j1 = p_76484_3_ - b0; j1 <= p_76484_3_ + b0 && flag; ++j1) - { - for (k1 = p_76484_5_ - b0; k1 <= p_76484_5_ + b0 && flag; ++k1) - { - if (i1 >= 0 && i1 < 256) - { - @SuppressWarnings("unused") - Block block = p_76484_1_.getBlock(j1, i1, k1); - - if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) - { - flag = false; - } - } - else - { - flag = false; - } - } - } - } - - if (!flag) - { - return false; - } - else - { - Block block3 = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ - 1, p_76484_5_); - - boolean isSoil = block3.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (IPlantable)Blocks.sapling); - if (isSoil && p_76484_4_ < 256 - l - 1) - { - block3.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); - int j3 = p_76484_2_.nextInt(4); - j1 = l - p_76484_2_.nextInt(4) - 1; - k1 = 3 - p_76484_2_.nextInt(3); - int k3 = p_76484_3_; - int l1 = p_76484_5_; - int i2 = 0; - int j2; - int k2; - - for (j2 = 0; j2 < l; ++j2) - { - k2 = p_76484_4_ + j2; - - if (j2 >= j1 && k1 > 0) - { - k3 += Direction.offsetX[j3]; - l1 += Direction.offsetZ[j3]; - --k1; - } - - Block block1 = p_76484_1_.getBlock(k3, k2, l1); - - if (block1.isAir(p_76484_1_, k3, k2, l1) || block1.isLeaves(p_76484_1_, k3, k2, l1)) - { - this.setBlockAndNotifyAdequately(p_76484_1_, k3, k2, l1, log, 0); - i2 = k2; - } - } - - for (j2 = -1; j2 <= 1; ++j2) - { - for (k2 = -1; k2 <= 1; ++k2) - { - this.func_150525_a(p_76484_1_, k3 + j2, i2 + 1, l1 + k2); - } - } - - this.func_150525_a(p_76484_1_, k3 + 2, i2 + 1, l1); - this.func_150525_a(p_76484_1_, k3 - 2, i2 + 1, l1); - this.func_150525_a(p_76484_1_, k3, i2 + 1, l1 + 2); - this.func_150525_a(p_76484_1_, k3, i2 + 1, l1 - 2); - - for (j2 = -3; j2 <= 3; ++j2) - { - for (k2 = -3; k2 <= 3; ++k2) - { - if (Math.abs(j2) != 3 || Math.abs(k2) != 3) - { - this.func_150525_a(p_76484_1_, k3 + j2, i2, l1 + k2); - } - } - } - - k3 = p_76484_3_; - l1 = p_76484_5_; - j2 = p_76484_2_.nextInt(4); - - if (j2 != j3) - { - k2 = j1 - p_76484_2_.nextInt(2) - 1; - int l3 = 1 + p_76484_2_.nextInt(3); - i2 = 0; - int l2; - int i3; - - for (l2 = k2; l2 < l && l3 > 0; --l3) - { - if (l2 >= 1) - { - i3 = p_76484_4_ + l2; - k3 += Direction.offsetX[j2]; - l1 += Direction.offsetZ[j2]; - Block block2 = p_76484_1_.getBlock(k3, i3, l1); - - if (block2.isAir(p_76484_1_, k3, i3, l1) || block2.isLeaves(p_76484_1_, k3, i3, l1)) - { - this.setBlockAndNotifyAdequately(p_76484_1_, k3, i3, l1, log, 0); - i2 = i3; - } - } - - ++l2; - } - - if (i2 > 0) - { - for (l2 = -1; l2 <= 1; ++l2) - { - for (i3 = -1; i3 <= 1; ++i3) - { - this.func_150525_a(p_76484_1_, k3 + l2, i2 + 1, l1 + i3); - } - } - - for (l2 = -2; l2 <= 2; ++l2) - { - for (i3 = -2; i3 <= 2; ++i3) - { - if (Math.abs(l2) != 2 || Math.abs(i3) != 2) - { - this.func_150525_a(p_76484_1_, k3 + l2, i2, l1 + i3); - } - } - } - } - } - - return true; - } - else - { - return false; - } - } - } - else - { - return false; - } - } - - private void func_150525_a(World p_150525_1_, int p_150525_2_, int p_150525_3_, int p_150525_4_) - { - Block block = p_150525_1_.getBlock(p_150525_2_, p_150525_3_, p_150525_4_); - - if (block.isAir(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_) || block.isLeaves(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_)) - { - this.setBlockAndNotifyAdequately(p_150525_1_, p_150525_2_, p_150525_3_, p_150525_4_, leaves, 0); - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestAbstractTree.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestAbstractTree.java deleted file mode 100644 index 1cbdab8f5d..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestAbstractTree.java +++ /dev/null @@ -1,33 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.gen; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.init.Blocks; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenerator; - -public abstract class WorldGenForestAbstractTree extends WorldGenerator -{ - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000399"; - - public WorldGenForestAbstractTree(boolean p_i45448_1_) - { - super(p_i45448_1_); - } - - protected boolean func_150523_a(Block p_150523_1_) - { - return p_150523_1_.getMaterial() == Material.air || p_150523_1_.getMaterial() == Material.leaves || p_150523_1_ == Blocks.grass || p_150523_1_ == Blocks.dirt || p_150523_1_ == Blocks.log || p_150523_1_ == Blocks.log || p_150523_1_ == Blocks.sapling || p_150523_1_ == Blocks.vine; - } - - public void func_150524_b(World p_150524_1_, Random p_150524_2_, int p_150524_3_, int p_150524_4_, int p_150524_5_) {} - - protected boolean isReplaceable(World world, int x, int y, int z) - { - Block block = world.getBlock(x, y, z); - return block.isAir(world, x, y, z) || block.isLeaves(world, x, y, z) || block.isWood(world, x, y, z) || func_150523_a(block); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestBigTree.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestBigTree.java deleted file mode 100644 index 5121fbc153..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestBigTree.java +++ /dev/null @@ -1,526 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.gen; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; - -public class WorldGenForestBigTree extends WorldGenForestAbstractTree -{ - private static Block log = Blocks.log; - private static Block leaves = Blocks.leaves; - - /** - * Contains three sets of two values that provide complimentary indices for - * a given 'major' index - 1 and 2 for 0, 0 and 2 for 1, and 0 and 1 for 2. - */ - static final byte[] otherCoordPairs = new byte[] { (byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1 }; - /** random seed for GenBigTree */ - Random rand = new Random(); - /** Reference to the World object. */ - World worldObj; - int[] basePos = new int[] { 0, 0, 0 }; - int heightLimit; - int height; - double heightAttenuation = 0.618D; - double branchDensity = 1.0D; - double branchSlope = 0.381D; - double scaleWidth = 1.0D; - double leafDensity = 1.0D; - /** - * Currently always 1, can be set to 2 in the class constructor to generate - * a double-sized tree trunk for big trees. - */ - int trunkSize = 1; - /** Sets the limit of the random value used to initialize the height limit. */ - int heightLimitLimit = 12; - /** - * Sets the distance limit for how far away the generator will populate - * leaves from the base leaf node. - */ - int leafDistanceLimit = 4; - /** Contains a list of a points at which to generate groups of leaves. */ - int[][] leafNodes; - - public WorldGenForestBigTree(boolean p_i2008_1_, int treeHeight, int trunkWidth, int leavesWidthFromBase) - { - super(p_i2008_1_); - this.trunkSize = trunkWidth; - this.heightLimitLimit = treeHeight; - this.leafDistanceLimit = leavesWidthFromBase; - } - - /** - * Generates a list of leaf nodes for the tree, to be populated by - * generateLeaves. - */ - void generateLeafNodeList() - { - this.height = (int) (this.heightLimit * this.heightAttenuation); - - if (this.height >= this.heightLimit) - { - this.height = this.heightLimit - 1; - } - - int i = (int) (1.382D + Math.pow(this.leafDensity * this.heightLimit / 13.0D, 2.0D)); - - if (i < 1) - { - i = 1; - } - - int[][] aint = new int[i * this.heightLimit][4]; - int j = this.basePos[1] + this.heightLimit - this.leafDistanceLimit; - int k = 1; - int l = this.basePos[1] + this.height; - int i1 = j - this.basePos[1]; - aint[0][0] = this.basePos[0]; - aint[0][1] = j; - aint[0][2] = this.basePos[2]; - aint[0][3] = l; - --j; - - while (i1 >= 0) - { - int j1 = 0; - float f = this.layerSize(i1); - - if (f < 0.0F) - { - --j; - --i1; - } - else - { - for (double d0 = 0.5D; j1 < i; ++j1) - { - double d1 = this.scaleWidth * f * (this.rand.nextFloat() + 0.328D); - double d2 = this.rand.nextFloat() * 2.0D * Math.PI; - int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + this.basePos[0] + d0); - int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + this.basePos[2] + d0); - int[] aint1 = new int[] { k1, j, l1 }; - int[] aint2 = new int[] { k1, j + this.leafDistanceLimit, l1 }; - - if (this.checkBlockLine(aint1, aint2) == -1) - { - int[] aint3 = new int[] { this.basePos[0], this.basePos[1], this.basePos[2] }; - double d3 = Math.sqrt(Math.pow(Math.abs(this.basePos[0] - aint1[0]), 2.0D) + Math.pow(Math.abs(this.basePos[2] - aint1[2]), 2.0D)); - double d4 = d3 * this.branchSlope; - - if (aint1[1] - d4 > l) - { - aint3[1] = l; - } - else - { - aint3[1] = (int) (aint1[1] - d4); - } - - if (this.checkBlockLine(aint3, aint1) == -1) - { - aint[k][0] = k1; - aint[k][1] = j; - aint[k][2] = l1; - aint[k][3] = aint3[1]; - ++k; - } - } - } - - --j; - --i1; - } - } - - this.leafNodes = new int[k][4]; - System.arraycopy(aint, 0, this.leafNodes, 0, k); - } - - void func_150529_a(int p_150529_1_, int p_150529_2_, int p_150529_3_, float p_150529_4_, byte p_150529_5_, Block p_150529_6_) - { - int l = (int) (p_150529_4_ + 0.618D); - byte b1 = otherCoordPairs[p_150529_5_]; - byte b2 = otherCoordPairs[p_150529_5_ + 3]; - int[] aint = new int[] { p_150529_1_, p_150529_2_, p_150529_3_ }; - int[] aint1 = new int[] { 0, 0, 0 }; - int i1 = -l; - int j1 = -l; - - for (aint1[p_150529_5_] = aint[p_150529_5_]; i1 <= l; ++i1) - { - aint1[b1] = aint[b1] + i1; - j1 = -l; - - while (j1 <= l) - { - double d0 = Math.pow(Math.abs(i1) + 0.5D, 2.0D) + Math.pow(Math.abs(j1) + 0.5D, 2.0D); - - if (d0 > p_150529_4_ * p_150529_4_) - { - ++j1; - } - else - { - aint1[b2] = aint[b2] + j1; - Block block1 = this.worldObj.getBlock(aint1[0], aint1[1], aint1[2]); - - if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) - { - ++j1; - } - else - { - this.setBlockAndNotifyAdequately(this.worldObj, aint1[0], aint1[1], aint1[2], p_150529_6_, 0); - ++j1; - } - } - } - } - } - - /** - * Gets the rough size of a layer of the tree. - */ - float layerSize(int p_76490_1_) - { - if (p_76490_1_ < (this.heightLimit) * 0.3D) - { - return -1.618F; - } - else - { - float f = this.heightLimit / 2.0F; - float f1 = this.heightLimit / 2.0F - p_76490_1_; - float f2; - - if (f1 == 0.0F) - { - f2 = f; - } - else if (Math.abs(f1) >= f) - { - f2 = 0.0F; - } - else - { - f2 = (float) Math.sqrt(Math.pow(Math.abs(f), 2.0D) - Math.pow(Math.abs(f1), 2.0D)); - } - - f2 *= 0.5F; - return f2; - } - } - - float leafSize(int p_76495_1_) - { - return p_76495_1_ >= 0 && p_76495_1_ < this.leafDistanceLimit ? (p_76495_1_ != 0 && p_76495_1_ != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; - } - - /** - * Generates the leaves surrounding an individual entry in the leafNodes - * list. - */ - void generateLeafNode(int p_76491_1_, int p_76491_2_, int p_76491_3_) - { - int l = p_76491_2_; - - for (int i1 = p_76491_2_ + this.leafDistanceLimit; l < i1; ++l) - { - float f = this.leafSize(l - p_76491_2_); - this.func_150529_a(p_76491_1_, l, p_76491_3_, f, (byte) 1, leaves); - } - } - - void func_150530_a(int[] p_150530_1_, int[] p_150530_2_, Block p_150530_3_) - { - int[] aint2 = new int[] { 0, 0, 0 }; - byte b0 = 0; - byte b1; - - for (b1 = 0; b0 < 3; ++b0) - { - aint2[b0] = p_150530_2_[b0] - p_150530_1_[b0]; - - if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) - { - b1 = b0; - } - } - - if (aint2[b1] != 0) - { - byte b2 = otherCoordPairs[b1]; - byte b3 = otherCoordPairs[b1 + 3]; - byte b4; - - if (aint2[b1] > 0) - { - b4 = 1; - } - else - { - b4 = -1; - } - - double d0 = (double) aint2[b2] / (double) aint2[b1]; - double d1 = (double) aint2[b3] / (double) aint2[b1]; - int[] aint3 = new int[] { 0, 0, 0 }; - int i = 0; - - for (int j = aint2[b1] + b4; i != j; i += b4) - { - aint3[b1] = MathHelper.floor_double(p_150530_1_[b1] + i + 0.5D); - aint3[b2] = MathHelper.floor_double(p_150530_1_[b2] + i * d0 + 0.5D); - aint3[b3] = MathHelper.floor_double(p_150530_1_[b3] + i * d1 + 0.5D); - byte b5 = 0; - int k = Math.abs(aint3[0] - p_150530_1_[0]); - int l = Math.abs(aint3[2] - p_150530_1_[2]); - int i1 = Math.max(k, l); - - if (i1 > 0) - { - if (k == i1) - { - b5 = 4; - } - else if (l == i1) - { - b5 = 8; - } - } - - this.setBlockAndNotifyAdequately(this.worldObj, aint3[0], aint3[1], aint3[2], p_150530_3_, b5); - } - } - } - - /** - * Generates the leaf portion of the tree as specified by the leafNodes - * list. - */ - void generateLeaves() - { - int i = 0; - - for (int j = this.leafNodes.length; i < j; ++i) - { - int k = this.leafNodes[i][0]; - int l = this.leafNodes[i][1]; - int i1 = this.leafNodes[i][2]; - this.generateLeafNode(k, l, i1); - } - } - - /** - * Indicates whether or not a leaf node requires additional wood to be added - * to preserve integrity. - */ - boolean leafNodeNeedsBase(int p_76493_1_) - { - return p_76493_1_ >= this.heightLimit * 0.2D; - } - - /** - * Places the trunk for the big tree that is being generated. Able to - * generate double-sized trunks by changing a field that is always 1 to 2. - */ - void generateTrunk() - { - int i = this.basePos[0]; - int j = this.basePos[1]; - int k = this.basePos[1] + this.height; - int l = this.basePos[2]; - int[] aint = new int[] { i, j, l }; - int[] aint1 = new int[] { i, k, l }; - this.func_150530_a(aint, aint1, log); - if (this.trunkSize == 2) - { - ++aint[0]; - ++aint1[0]; - this.func_150530_a(aint, aint1, log); - ++aint[2]; - ++aint1[2]; - this.func_150530_a(aint, aint1, log); - aint[0] += -1; - aint1[0] += -1; - this.func_150530_a(aint, aint1, log); - } - } - - /** - * Generates additional wood blocks to fill out the bases of different leaf - * nodes that would otherwise degrade. - */ - void generateLeafNodeBases() - { - int i = 0; - int j = this.leafNodes.length; - - for (int[] aint = new int[] { this.basePos[0], this.basePos[1], this.basePos[2] }; i < j; ++i) - { - int[] aint1 = this.leafNodes[i]; - int[] aint2 = new int[] { aint1[0], aint1[1], aint1[2] }; - aint[1] = aint1[3]; - int k = aint[1] - this.basePos[1]; - - if (this.leafNodeNeedsBase(k)) - { - this.func_150530_a(aint, aint2, log); - } - } - } - - /** - * Checks a line of blocks in the world from the first coordinate to triplet - * to the second, returning the distance (in blocks) before a non-air, - * non-leaf block is encountered and/or the end is encountered. - */ - int checkBlockLine(int[] p_76496_1_, int[] p_76496_2_) - { - int[] aint2 = new int[] { 0, 0, 0 }; - byte b0 = 0; - byte b1; - - for (b1 = 0; b0 < 3; ++b0) - { - aint2[b0] = p_76496_2_[b0] - p_76496_1_[b0]; - - if (Math.abs(aint2[b0]) > Math.abs(aint2[b1])) - { - b1 = b0; - } - } - - if (aint2[b1] == 0) - { - return -1; - } - else - { - byte b2 = otherCoordPairs[b1]; - byte b3 = otherCoordPairs[b1 + 3]; - byte b4; - - if (aint2[b1] > 0) - { - b4 = 1; - } - else - { - b4 = -1; - } - - double d0 = (double) aint2[b2] / (double) aint2[b1]; - double d1 = (double) aint2[b3] / (double) aint2[b1]; - int[] aint3 = new int[] { 0, 0, 0 }; - int i = 0; - int j; - - for (j = aint2[b1] + b4; i != j; i += b4) - { - aint3[b1] = p_76496_1_[b1] + i; - aint3[b2] = MathHelper.floor_double(p_76496_1_[b2] + i * d0); - aint3[b3] = MathHelper.floor_double(p_76496_1_[b3] + i * d1); - @SuppressWarnings("unused") - Block block = this.worldObj.getBlock(aint3[0], aint3[1], aint3[2]); - - if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) - { - break; - } - } - - return i == j ? -1 : Math.abs(i); - } - } - - /** - * Returns a boolean indicating whether or not the current location for the - * tree, spanning basePos to to the height limit, is valid. - */ - boolean validTreeLocation() - { - int[] aint = new int[] { this.basePos[0], this.basePos[1], this.basePos[2] }; - int[] aint1 = new int[] { this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2] }; - Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); - boolean isSoil = false; - - if (block == Blocks.grass || block == Blocks.grass) { - isSoil = true; - } - - if (!isSoil) - { - return false; - } - else - { - int i = this.checkBlockLine(aint, aint1); - - if (i == -1) - { - return true; - } - else if (i < 6) - { - return false; - } - else - { - this.heightLimit = i; - return true; - } - } - } - - /** - * Rescales the generator settings, only used in WorldGenBigTree - */ - @Override - public void setScale(double p_76487_1_, double p_76487_3_, double p_76487_5_) - { - this.heightLimitLimit = (int) (p_76487_1_ * 12.0D); - - if (p_76487_1_ > 0.5D) - { - this.leafDistanceLimit = 5; - } - - this.scaleWidth = p_76487_3_; - this.leafDensity = p_76487_5_; - } - - @Override - public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) - { - this.worldObj = p_76484_1_; - long l = p_76484_2_.nextLong(); - this.rand.setSeed(l); - this.basePos[0] = p_76484_3_; - this.basePos[1] = p_76484_4_; - this.basePos[2] = p_76484_5_; - - if (this.heightLimit == 0) - { - this.heightLimit = 5 + this.rand.nextInt(this.heightLimitLimit); - } - - if (!this.validTreeLocation()) - { - this.worldObj = null; // Fix vanilla Mem leak, holds latest world - return false; - } - else - { - this.generateLeafNodeList(); - this.generateLeaves(); - this.generateTrunk(); - this.generateLeafNodeBases(); - this.worldObj = null; // Fix vanilla Mem leak, holds latest world - return true; - } - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestGrass.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestGrass.java deleted file mode 100644 index 00e79fc72f..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestGrass.java +++ /dev/null @@ -1,51 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.gen; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenerator; - -public class WorldGenForestGrass extends WorldGenerator -{ - private Block field_150522_a; - private int tallGrassMetadata; - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000437"; - - public WorldGenForestGrass(Block p_i45466_1_, int p_i45466_2_) - { - this.field_150522_a = p_i45466_1_; - this.tallGrassMetadata = p_i45466_2_; - } - - @Override - public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) - { - Block block; - - do - { - block = p_76484_1_.getBlock(p_76484_3_, p_76484_4_, p_76484_5_); - if (!(block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_) || block.isAir(p_76484_1_, p_76484_3_, p_76484_4_, p_76484_5_))) - { - break; - } - --p_76484_4_; - } while (p_76484_4_ > 0); - - for (int l = 0; l < 128; ++l) - { - int i1 = p_76484_3_ + p_76484_2_.nextInt(8) - p_76484_2_.nextInt(8); - int j1 = p_76484_4_ + p_76484_2_.nextInt(4) - p_76484_2_.nextInt(4); - int k1 = p_76484_5_ + p_76484_2_.nextInt(8) - p_76484_2_.nextInt(8); - - if (p_76484_1_.isAirBlock(i1, j1, k1) && this.field_150522_a.canBlockStay(p_76484_1_, i1, j1, k1)) - { - p_76484_1_.setBlock(i1, j1, k1, this.field_150522_a, this.tallGrassMetadata, 2); - } - } - - return true; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestTrees.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestTrees.java deleted file mode 100644 index 18791b0d15..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenForestTrees.java +++ /dev/null @@ -1,252 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.gen; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockSapling; -import net.minecraft.init.Blocks; -import net.minecraft.util.Direction; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public class WorldGenForestTrees extends WorldGenForestAbstractTree -{ - /** The minimum height of a generated tree. */ - private final int minTreeHeight; - /** True if this tree should grow Vines. */ - private final boolean vinesGrow; - /** The wood to use in tree generation. */ - private static Block wood; - /** The leaves to use in tree generation. */ - private static Block leaves; - - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000438"; - - public WorldGenForestTrees(boolean p_i2027_1_) - { - this(p_i2027_1_, 6, leaves, wood, false); - } - - public WorldGenForestTrees(boolean p_i2028_1_, int minTreeHeight, Block metaWood, Block metaLeaves, boolean growVines) - { - super(p_i2028_1_); - this.minTreeHeight = minTreeHeight; - WorldGenForestTrees.wood = metaWood; - WorldGenForestTrees.leaves = metaLeaves; - this.vinesGrow = growVines; - } - - @Override - public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) - { - int l = p_76484_2_.nextInt(3) + this.minTreeHeight; - boolean flag = true; - - if (p_76484_4_ >= 1 && p_76484_4_ + l + 1 <= 256) - { - byte b0; - int k1; - Block block; - - for (int i1 = p_76484_4_; i1 <= p_76484_4_ + 1 + l; ++i1) - { - b0 = 1; - - if (i1 == p_76484_4_) - { - b0 = 0; - } - - if (i1 >= p_76484_4_ + 1 + l - 2) - { - b0 = 2; - } - - for (int j1 = p_76484_3_ - b0; j1 <= p_76484_3_ + b0 && flag; ++j1) - { - for (k1 = p_76484_5_ - b0; k1 <= p_76484_5_ + b0 && flag; ++k1) - { - if (i1 >= 0 && i1 < 256) - { - block = p_76484_1_.getBlock(j1, i1, k1); - - if (!this.isReplaceable(p_76484_1_, j1, i1, k1)) - { - flag = false; - } - } - else - { - flag = false; - } - } - } - } - - if (!flag) - { - return false; - } - else - { - Block block2 = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ - 1, p_76484_5_); - - boolean isSoil = block2.canSustainPlant(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, ForgeDirection.UP, (BlockSapling)Blocks.sapling); - if (isSoil && p_76484_4_ < 256 - l - 1) - { - block2.onPlantGrow(p_76484_1_, p_76484_3_, p_76484_4_ - 1, p_76484_5_, p_76484_3_, p_76484_4_, p_76484_5_); - b0 = 3; - byte b1 = 0; - int l1; - int i2; - int j2; - int i3; - - for (k1 = p_76484_4_ - b0 + l; k1 <= p_76484_4_ + l; ++k1) - { - i3 = k1 - (p_76484_4_ + l); - l1 = b1 + 1 - i3 / 2; - - for (i2 = p_76484_3_ - l1; i2 <= p_76484_3_ + l1; ++i2) - { - j2 = i2 - p_76484_3_; - - for (int k2 = p_76484_5_ - l1; k2 <= p_76484_5_ + l1; ++k2) - { - int l2 = k2 - p_76484_5_; - - if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || p_76484_2_.nextInt(2) != 0 && i3 != 0) - { - Block block1 = p_76484_1_.getBlock(i2, k1, k2); - - if (block1.isAir(p_76484_1_, i2, k1, k2) || block1.isLeaves(p_76484_1_, i2, k1, k2)) - { - this.setBlockAndNotifyAdequately(p_76484_1_, i2, k1, k2, Blocks.leaves, 0); - } - } - } - } - } - - for (k1 = 0; k1 < l; ++k1) - { - block = p_76484_1_.getBlock(p_76484_3_, p_76484_4_ + k1, p_76484_5_); - - if (block.isAir(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_) || block.isLeaves(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_)) - { - this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_, Blocks.log, 0); - -// if (this.vinesGrow && k1 > 0) -// { -// if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_ - 1, p_76484_4_ + k1, p_76484_5_)) -// { -// this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ - 1, p_76484_4_ + k1, p_76484_5_, Blocks.vine, 8); -// } -// -// if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_ + 1, p_76484_4_ + k1, p_76484_5_)) -// { -// this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ + 1, p_76484_4_ + k1, p_76484_5_, Blocks.vine, 2); -// } -// -// if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_, p_76484_4_ + k1, p_76484_5_ - 1)) -// { -// this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_ - 1, Blocks.vine, 1); -// } -// -// if (p_76484_2_.nextInt(3) > 0 && p_76484_1_.isAirBlock(p_76484_3_, p_76484_4_ + k1, p_76484_5_ + 1)) -// { -// this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_, p_76484_4_ + k1, p_76484_5_ + 1, Blocks.vine, 4); -// } -// } - } - } - - if (this.vinesGrow) - { - for (k1 = p_76484_4_ - 3 + l; k1 <= p_76484_4_ + l; ++k1) - { - i3 = k1 - (p_76484_4_ + l); - l1 = 2 - i3 / 2; - - for (i2 = p_76484_3_ - l1; i2 <= p_76484_3_ + l1; ++i2) - { - for (j2 = p_76484_5_ - l1; j2 <= p_76484_5_ + l1; ++j2) - { -// if (p_76484_1_.getBlock(i2, k1, j2).isLeaves(p_76484_1_, i2, k1, j2)) -// { -// if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.getBlock(i2 - 1, k1, j2).isAir(p_76484_1_, i2 - 1, k1, j2)) -// { -// this.growVines(p_76484_1_, i2 - 1, k1, j2, 8); -// } -// -// if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.getBlock(i2 + 1, k1, j2).isAir(p_76484_1_, i2 + 1, k1, j2)) -// { -// this.growVines(p_76484_1_, i2 + 1, k1, j2, 2); -// } -// -// if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.getBlock(i2, k1, j2 - 1).isAir(p_76484_1_, i2, k1, j2 - 1)) -// { -// this.growVines(p_76484_1_, i2, k1, j2 - 1, 1); -// } -// -// if (p_76484_2_.nextInt(4) == 0 && p_76484_1_.getBlock(i2, k1, j2 + 1).isAir(p_76484_1_, i2, k1, j2 + 1)) -// { -// this.growVines(p_76484_1_, i2, k1, j2 + 1, 4); -// } -// } - } - } - } - - if (p_76484_2_.nextInt(5) == 0 && l > 5) - { - for (k1 = 0; k1 < 2; ++k1) - { - for (i3 = 0; i3 < 4; ++i3) - { - if (p_76484_2_.nextInt(4 - k1) == 0) - { - l1 = p_76484_2_.nextInt(3); - this.setBlockAndNotifyAdequately(p_76484_1_, p_76484_3_ + Direction.offsetX[Direction.rotateOpposite[i3]], p_76484_4_ + l - 5 + k1, p_76484_5_ + Direction.offsetZ[Direction.rotateOpposite[i3]], Blocks.cocoa, l1 << 2 | i3); - } - } - } - } - } - return true; - } - else - { - return false; - } - } - } - else - { - return false; - } - } - - /** - * Grows vines downward from the given block for a given length. Args: World, x, starty, z, vine-length - */ -// private void growVines(World p_76529_1_, int p_76529_2_, int p_76529_3_, int p_76529_4_, int p_76529_5_) -// { -// this.setBlockAndNotifyAdequately(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_, Blocks.vine, p_76529_5_); -// int i1 = 4; -// -// while (true) -// { -// --p_76529_3_; -// -// if (!p_76529_1_.getBlock(p_76529_2_, p_76529_3_, p_76529_4_).isAir(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_) || i1 <= 0) -// { -// return; -// } -// -// this.setBlockAndNotifyAdequately(p_76529_1_, p_76529_2_, p_76529_3_, p_76529_4_, Blocks.vine, p_76529_5_); -// --i1; -// } -// } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenModMinable.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenModMinable.java deleted file mode 100644 index ef177493a1..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/gen/WorldGenModMinable.java +++ /dev/null @@ -1,109 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.gen; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenerator; - -public class WorldGenModMinable extends WorldGenerator -{ - /** Block to replace */ - private Block field_150519_a; - - /** The number of blocks to generate. */ - private int numberOfBlocks; - - /** Ore to place in World */ - private Block field_150518_c; - - @SuppressWarnings("unused") - private static final String __OBFID = "CL_00000426"; - private int mineableBlockMeta; - - /** - * Generates Ores in World. - * @param blockToPlace - * @param howMeny - * @param replaceableBlock - */ - public WorldGenModMinable(Block blockToPlace, int howMeny, Block replaceableBlock) - { - this.field_150519_a = blockToPlace; - this.numberOfBlocks = howMeny; - this.field_150518_c = replaceableBlock; - } - - /** - * Generates Ores in World. - * @param block - * @param meta - * @param number - * @param target - */ - public WorldGenModMinable(Block block, int meta, int number, Block target) - { - this(block, number, target); - this.mineableBlockMeta = meta; - } - - /** - * Replaces Blocks with ores. - */ - @Override - public boolean generate(World p_76484_1_, Random p_76484_2_, int p_76484_3_, int p_76484_4_, int p_76484_5_) - { - float f = p_76484_2_.nextFloat() * (float)Math.PI; - double d0 = p_76484_3_ + 8 + MathHelper.sin(f) * this.numberOfBlocks / 8.0F; - double d1 = p_76484_3_ + 8 - MathHelper.sin(f) * this.numberOfBlocks / 8.0F; - double d2 = p_76484_5_ + 8 + MathHelper.cos(f) * this.numberOfBlocks / 8.0F; - double d3 = p_76484_5_ + 8 - MathHelper.cos(f) * this.numberOfBlocks / 8.0F; - double d4 = p_76484_4_ + p_76484_2_.nextInt(3) - 2; - double d5 = p_76484_4_ + p_76484_2_.nextInt(3) - 2; - - for (int l = 0; l <= this.numberOfBlocks; ++l) - { - double d6 = d0 + (d1 - d0) * l / this.numberOfBlocks; - double d7 = d4 + (d5 - d4) * l / this.numberOfBlocks; - double d8 = d2 + (d3 - d2) * l / this.numberOfBlocks; - double d9 = p_76484_2_.nextDouble() * this.numberOfBlocks / 16.0D; - double d10 = (MathHelper.sin(l * (float)Math.PI / this.numberOfBlocks) + 1.0F) * d9 + 1.0D; - double d11 = (MathHelper.sin(l * (float)Math.PI / this.numberOfBlocks) + 1.0F) * d9 + 1.0D; - int i1 = MathHelper.floor_double(d6 - d10 / 2.0D); - int j1 = MathHelper.floor_double(d7 - d11 / 2.0D); - int k1 = MathHelper.floor_double(d8 - d10 / 2.0D); - int l1 = MathHelper.floor_double(d6 + d10 / 2.0D); - int i2 = MathHelper.floor_double(d7 + d11 / 2.0D); - int j2 = MathHelper.floor_double(d8 + d10 / 2.0D); - - for (int k2 = i1; k2 <= l1; ++k2) - { - double d12 = (k2 + 0.5D - d6) / (d10 / 2.0D); - - if (d12 * d12 < 1.0D) - { - for (int l2 = j1; l2 <= i2; ++l2) - { - double d13 = (l2 + 0.5D - d7) / (d11 / 2.0D); - - if (d12 * d12 + d13 * d13 < 1.0D) - { - for (int i3 = k1; i3 <= j2; ++i3) - { - double d14 = (i3 + 0.5D - d8) / (d10 / 2.0D); - - if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && p_76484_1_.getBlock(k2, l2, i3).isReplaceableOreGen(p_76484_1_, k2, l2, i3, field_150518_c)) - { - p_76484_1_.setBlock(k2, l2, i3, this.field_150519_a, mineableBlockMeta, 2); - } - } - } - } - } - } - } - - return true; - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/genlayer/LightForestGenLayer.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/genlayer/LightForestGenLayer.java deleted file mode 100644 index f27d710fae..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/genlayer/LightForestGenLayer.java +++ /dev/null @@ -1,30 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.genlayer; - -import net.minecraft.world.WorldType; -import net.minecraft.world.gen.layer.*; - -public class LightForestGenLayer extends GenLayer { - - public LightForestGenLayer(long seed) { - super(seed); - } - - public static GenLayer[] makeTheWorld(long seed, WorldType type) { - GenLayer biomes = new LightForestGenLayerBiomes(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 null; - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/genlayer/LightForestGenLayerBiomes.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/genlayer/LightForestGenLayerBiomes.java deleted file mode 100644 index 5e54fcb2ba..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/genlayer/LightForestGenLayerBiomes.java +++ /dev/null @@ -1,33 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.genlayer; - -import gtPlusPlus.core.world.dimensionA.world.biomes.ModBiomes; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraft.world.gen.layer.GenLayer; -import net.minecraft.world.gen.layer.IntCache; - -public class LightForestGenLayerBiomes extends GenLayer { - - // TODO: spawning with temperatures - protected BiomeGenBase[] allowedBiomes = { ModBiomes.forestLight, }; - - public LightForestGenLayerBiomes(long seed) { - super(seed); - } - - public LightForestGenLayerBiomes(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; - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/CloudRenderer.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/CloudRenderer.java deleted file mode 100644 index 39d8a468b3..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/CloudRenderer.java +++ /dev/null @@ -1,13 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.renderers; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraftforge.client.IRenderHandler; - -public class CloudRenderer extends IRenderHandler { - - @Override - public void render(float partialTicks, WorldClient world, Minecraft mc) { - - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/SkyRenderer.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/SkyRenderer.java deleted file mode 100644 index 69e3db720e..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/SkyRenderer.java +++ /dev/null @@ -1,201 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.renderers; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.*; -import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.renderer.*; -import net.minecraft.util.*; -import net.minecraftforge.client.IRenderHandler; - -public class SkyRenderer extends IRenderHandler { - - private int starGLCallList; - private int glSkyList; - private int glSkyList2; - - public SkyRenderer() - { - RenderGlobal renderGlobal = Minecraft.getMinecraft().renderGlobal; - this.glSkyList2 = (this.glSkyList = (this.starGLCallList = ReflectionHelper.getPrivateValue(RenderGlobal.class, renderGlobal, "starGLCallList")) + 1) + 1; - } - - @Override - @SideOnly(Side.CLIENT) - public void render(float partialTicks, WorldClient world, Minecraft mc) { - GL11.glDisable(GL11.GL_TEXTURE_2D); - Vec3 vec3 = world.getSkyColor(mc.renderViewEntity, partialTicks); - float f1 = (float) vec3.xCoord; - float f2 = (float) vec3.yCoord; - float f3 = (float) vec3.zCoord; - float f4; - if (mc.gameSettings.anaglyph) - { - float f5 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; - float f6 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; - f4 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; - f1 = f5; - f2 = f6; - f3 = f4; - } - GL11.glColor3f(f1, f2, f3); - Tessellator tessellator1 = Tessellator.instance; - GL11.glDepthMask(false); - GL11.glEnable(GL11.GL_FOG); - GL11.glColor3f(f1, f2, f3); - GL11.glCallList(this.glSkyList); - GL11.glDisable(GL11.GL_FOG); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.disableStandardItemLighting(); - float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks), partialTicks); - float f7; - float f8; - float f9; - float f10; - if (afloat != null) - { - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glShadeModel(GL11.GL_SMOOTH); - GL11.glPushMatrix(); - GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F); - f4 = afloat[0]; - f7 = afloat[1]; - f8 = afloat[2]; - float f11; - if (mc.gameSettings.anaglyph) - { - f9 = (f4 * 30.0F + f7 * 59.0F + f8 * 11.0F) / 100.0F; - f10 = (f4 * 30.0F + f7 * 70.0F) / 100.0F; - f11 = (f4 * 30.0F + f8 * 70.0F) / 100.0F; - f4 = f9; - f7 = f10; - f8 = f11; - } - tessellator1.startDrawing(6); - tessellator1.setColorRGBA_F(f4, f7, f8, afloat[3]); - tessellator1.addVertex(0.0D, 100.0D, 0.0D); - byte b0 = 16; - tessellator1.setColorRGBA_F(afloat[0], afloat[1], afloat[2], 0.0F); - for (int j = 0; j <= b0; ++j) - { - f11 = j * (float) Math.PI * 2.0F / b0; - float f12 = MathHelper.sin(f11); - float f13 = MathHelper.cos(f11); - tessellator1.addVertex(f12 * 120.0F, f13 * 120.0F, -f13 * 40.0F * afloat[3]); - } - tessellator1.draw(); - GL11.glPopMatrix(); - GL11.glShadeModel(GL11.GL_FLAT); - } - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); - GL11.glPushMatrix(); - f4 = 1.0F - world.getRainStrength(partialTicks); - f7 = 0.0F; - f8 = 0.0F; - f9 = 0.0F; - GL11.glColor4f(1.0F, 1.0F, 1.0F, f4); - GL11.glTranslatef(f7, f8, f9); - GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F); - - - f10 = 20.0F; // Size of sun from center - mc.renderEngine.getTexture(new ResourceLocation(CORE.MODID+":/textures/enviroment/sun.png")); - - - tessellator1.startDrawingQuads(); - tessellator1.addVertexWithUV((-f10), 100.0D, (-f10), 0.0D, 0.0D); - tessellator1.addVertexWithUV(f10, 100.0D, (-f10), 1.0D, 0.0D); - tessellator1.addVertexWithUV(f10, 100.0D, f10, 1.0D, 1.0D); - tessellator1.addVertexWithUV((-f10), 100.0D, f10, 0.0D, 1.0D); - - - tessellator1.draw(); // Draw sun - f10 = 15.0F; // Size of moon from center - mc.renderEngine.bindTexture(new ResourceLocation(CORE.MODID+":/textures/enviroment/moon_phases.png")); - - - int k = world.getMoonPhase(); - int l = k % 4; - int i1 = k / 4 % 2; - float f14 = (l + 0) / 4.0F; - float f15 = (i1 + 0) / 2.0F; - float f16 = (l + 1) / 4.0F; - float f17 = (i1 + 1) / 2.0F; - tessellator1.startDrawingQuads(); - tessellator1.addVertexWithUV((-f10), -100.0D, f10, f16, f17); - tessellator1.addVertexWithUV(f10, -100.0D, f10, f14, f17); - tessellator1.addVertexWithUV(f10, -100.0D, (-f10), f14, f15); - tessellator1.addVertexWithUV((-f10), -100.0D, (-f10), f16, f15); - tessellator1.draw(); - GL11.glDisable(GL11.GL_TEXTURE_2D); - float f18 = world.getStarBrightness(partialTicks) * f4; - if (f18 > 0.0F) - { - GL11.glColor4f(f18, f18, f18, f18); - GL11.glCallList(this.starGLCallList); - } - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glDisable(GL11.GL_BLEND); - GL11.glEnable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_FOG); - GL11.glPopMatrix(); - GL11.glDisable(GL11.GL_TEXTURE_2D); - GL11.glColor3f(0.0F, 0.0F, 0.0F); - double d0 = mc.thePlayer.getPosition(partialTicks).yCoord - world.getHorizon(); - if (d0 < 0.0D) - { - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, 12.0F, 0.0F); - GL11.glCallList(this.glSkyList2); - GL11.glPopMatrix(); - f8 = 1.0F; - f9 = -((float) (d0 + 65.0D)); - f10 = -f8; - tessellator1.startDrawingQuads(); - tessellator1.setColorRGBA_I(0, 255); - tessellator1.addVertex((-f8), f9, f8); - tessellator1.addVertex(f8, f9, f8); - tessellator1.addVertex(f8, f10, f8); - tessellator1.addVertex((-f8), f10, f8); - tessellator1.addVertex((-f8), f10, (-f8)); - tessellator1.addVertex(f8, f10, (-f8)); - tessellator1.addVertex(f8, f9, (-f8)); - tessellator1.addVertex((-f8), f9, (-f8)); - tessellator1.addVertex(f8, f10, (-f8)); - tessellator1.addVertex(f8, f10, f8); - tessellator1.addVertex(f8, f9, f8); - tessellator1.addVertex(f8, f9, (-f8)); - tessellator1.addVertex((-f8), f9, (-f8)); - tessellator1.addVertex((-f8), f9, f8); - tessellator1.addVertex((-f8), f10, f8); - tessellator1.addVertex((-f8), f10, (-f8)); - tessellator1.addVertex((-f8), f10, (-f8)); - tessellator1.addVertex((-f8), f10, f8); - tessellator1.addVertex(f8, f10, f8); - tessellator1.addVertex(f8, f10, (-f8)); - tessellator1.draw(); - } - if (world.provider.isSkyColored()) - { - GL11.glColor3f(0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F); - } - else - { - GL11.glColor3f(f1, f2, f3); - } - GL11.glPushMatrix(); - GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F); - GL11.glCallList(this.glSkyList2); - GL11.glPopMatrix(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glDepthMask(true); - } -} diff --git a/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/WeatherRenderer.java b/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/WeatherRenderer.java deleted file mode 100644 index ef64f9fbb8..0000000000 --- a/src/Java/gtPlusPlus/core/world/dimensionA/world/renderers/WeatherRenderer.java +++ /dev/null @@ -1,227 +0,0 @@ -package gtPlusPlus.core.world.dimensionA.world.renderers; - -import java.util.Random; - -import org.lwjgl.opengl.GL11; - -import gtPlusPlus.core.lib.CORE; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.MathHelper; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.biome.BiomeGenBase; -import net.minecraftforge.client.IRenderHandler; - -public class WeatherRenderer extends IRenderHandler { - - /** Rain X coords */ - float[] rainXCoords; - /** Rain Y coords */ - float[] rainYCoords; - -// EntityRenderer enitytRenderer; - Random rand = new Random(); - - private String weather_Name; - - private static final ResourceLocation locationRainPng = new ResourceLocation(CORE.MODID, "textures/environment/snow.png"); - - @Override - public void render(float partialTicks, WorldClient world, Minecraft mc) { - this.getWeatherToRenderer("fog"); - if(weather_Name != null){ - if(weather_Name == "fog"){ - // this.renderFog(partialTicks, world, mc, 50); - this.renderRainSnow(50, world, mc); - } - } - } - - public void getWeatherToRenderer(String weatherName){ - weather_Name = weatherName; - } - - protected void renderRainSnow(float par1, WorldClient world, Minecraft mc) - { -// IRenderHandler renderer = null; -// if ((renderer = mc.theWorld.provider.getWeatherRenderer()) != null) -// { -// renderer.render(par1, mc.theWorld, mc); -// return; -// } - - float f1 = mc.theWorld.getRainStrength(par1); - - if (f1 > 0.0F) - { -// enitytRenderer.enableLightmap((double)par1); - - if (this.rainXCoords == null) - { - this.rainXCoords = new float[1024]; - this.rainYCoords = new float[1024]; - - for (int i = 0; i < 32; ++i) - { - for (int j = 0; j < 32; ++j) - { - float f2 = j - 16; - float f3 = i - 16; - float f4 = MathHelper.sqrt_float(f2 * f2 + f3 * f3); - this.rainXCoords[i << 5 | j] = -f3 / f4; - this.rainYCoords[i << 5 | j] = f2 / f4; - } - } - } - - EntityLivingBase entitylivingbase = mc.renderViewEntity; - WorldClient worldclient = mc.theWorld; - int k2 = MathHelper.floor_double(entitylivingbase.posX); - int l2 = MathHelper.floor_double(entitylivingbase.posY); - int i3 = MathHelper.floor_double(entitylivingbase.posZ); - Tessellator tessellator = Tessellator.instance; - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GL11.glEnable(GL11.GL_BLEND); - OpenGlHelper.glBlendFunc(770, 771, 1, 0); - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - double d0 = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * par1; - double d1 = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * par1; - double d2 = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * par1; - int k = MathHelper.floor_double(d1); - byte b0 = 5; - - if (mc.gameSettings.fancyGraphics) - { - b0 = 10; - } - - boolean flag = false; - byte b1 = -1; - float f5 = 312545411L + par1; - - if (mc.gameSettings.fancyGraphics) - { - b0 = 10; - } - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - flag = false; - - for (int l = i3 - b0; l <= i3 + b0; ++l) - { - for (int i1 = k2 - b0; i1 <= k2 + b0; ++i1) - { - int j1 = (l - i3 + 16) * 32 + i1 - k2 + 16; - float f6 = this.rainXCoords[j1] * 0.5F; - float f7 = this.rainYCoords[j1] * 0.5F; - BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(i1, l); - - if (biomegenbase.canSpawnLightningBolt() || biomegenbase.getEnableSnow()) - { - int k1 = worldclient.getPrecipitationHeight(i1, l); - int l1 = l2 - b0; - int i2 = l2 + b0; - - if (l1 < k1) - { - l1 = k1; - } - - if (i2 < k1) - { - i2 = k1; - } - - float f8 = 1.0F; - int j2 = k1; - - if (k1 < k) - { - j2 = k; - } - - if (l1 != i2) - { - rand.setSeed(i1 * i1 * 3121 + i1 * 45238971 ^ l * l * 418711 + l * 13761); - float f9 = biomegenbase.getFloatTemperature(i1, l1, l); - float f10; - double d4; - - if (worldclient.getWorldChunkManager().getTemperatureAtHeight(f9, k1) >= 0.15F) - { - if (b1 != 0) - { - if (b1 >= 0) - { - tessellator.draw(); - } - - b1 = 0; - mc.getTextureManager().bindTexture(locationRainPng); - tessellator.startDrawingQuads(); - } - - f10 = ((31542152L + i1 * i1 * 3121 + i1 * 45238971 + l * l * 418711 + l * 13761 & 31) + par1) / 32.0F * (3.0F + this.rand.nextFloat()); - double d3 = i1 + 0.5F - entitylivingbase.posX; - d4 = l + 0.5F - entitylivingbase.posZ; - float f12 = MathHelper.sqrt_double(d3 * d3 + d4 * d4) / b0; - float f13 = 1.0F; - tessellator.setBrightness(worldclient.getLightBrightnessForSkyBlocks(i1, j2, l, 0)); - tessellator.setColorRGBA_F(f13, f13, f13, ((1.0F - f12 * f12) * 0.5F + 0.5F) * f1); - tessellator.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D); - tessellator.addVertexWithUV(i1 - f6 + 0.5D, l1, l - f7 + 0.5D, 0.0F * f8, l1 * f8 / 4.0F + f10 * f8); - tessellator.addVertexWithUV(i1 + f6 + 0.5D, l1, l + f7 + 0.5D, 1.0F * f8, l1 * f8 / 4.0F + f10 * f8); - tessellator.addVertexWithUV(i1 + f6 + 0.5D, i2, l + f7 + 0.5D, 1.0F * f8, i2 * f8 / 4.0F + f10 * f8); - tessellator.addVertexWithUV(i1 - f6 + 0.5D, i2, l - f7 + 0.5D, 0.0F * f8, i2 * f8 / 4.0F + f10 * f8); - tessellator.setTranslation(0.0D, 0.0D, 0.0D); - } -// else -// { -// if (b1 != 1) -// { -// if (b1 >= 0) -// { -// tessellator.draw(); -// } -// -// b1 = 1; -// mc.getTextureManager().bindTexture(locationSnowPng); -// tessellator.startDrawingQuads(); -// } -// -// f10 = ((float)(3584865L & 511) + par1) / 512.0F; -// float f16 = this.rand.nextFloat() + f5 * 0.01F * (float)this.rand.nextGaussian(); -// float f11 = this.rand.nextFloat() + f5 * (float)this.rand.nextGaussian() * 0.001F; -// d4 = (double)((float)i1 + 0.5F) - entitylivingbase.posX; -// double d5 = (double)((float)l + 0.5F) - entitylivingbase.posZ; -// float f14 = MathHelper.sqrt_double(d4 * d4 + d5 * d5) / (float)b0; -// float f15 = 1.0F; -// tessellator.setBrightness((worldclient.getLightBrightnessForSkyBlocks(i1, j2, l, 0) * 3 + 15728880) / 4); -// tessellator.setColorRGBA_F(f15, f15, f15, ((1.0F - f14 * f14) * 0.3F + 0.5F) * f1); -// tessellator.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D); -// tessellator.addVertexWithUV((double)((float)i1 - f6) + 0.5D, (double)l1, (double)((float)l - f7) + 0.5D, (double)(0.0F * f8 + f16), (double)((float)l1 * f8 / 4.0F + f10 * f8 + f11)); -// tessellator.addVertexWithUV((double)((float)i1 + f6) + 0.5D, (double)l1, (double)((float)l + f7) + 0.5D, (double)(1.0F * f8 + f16), (double)((float)l1 * f8 / 4.0F + f10 * f8 + f11)); -// tessellator.addVertexWithUV((double)((float)i1 + f6) + 0.5D, (double)i2, (double)((float)l + f7) + 0.5D, (double)(1.0F * f8 + f16), (double)((float)i2 * f8 / 4.0F + f10 * f8 + f11)); -// tessellator.addVertexWithUV((double)((float)i1 - f6) + 0.5D, (double)i2, (double)((float)l - f7) + 0.5D, (double)(0.0F * f8 + f16), (double)((float)i2 * f8 / 4.0F + f10 * f8 + f11)); -// tessellator.setTranslation(0.0D, 0.0D, 0.0D); -// } - } - } - } - } - - if (b1 >= 0) - { - tessellator.draw(); - } - - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_BLEND); - GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); - } - } -} |