Jump to content

hydroflame

Members
  • Posts

    1511
  • Joined

  • Last visited

Posts posted by hydroflame

  1. Also, signing java jars with my private key is actually seriously hard to do if you don't have my private key. That's the whole point of cryptography. If you think you can forge my signature, I'd love to see you try.

     

    they could sign it with another key. obviously the private/public key system is super secure, but i could technicly make another jar and sign it with another key, insert that key in the mod as well and tada the whole thing is screwed.

     

    of course this signed jar could not log into YOUR server because you are signed with the original key but they could easily sign into other server with the same key and or single player.

     

    Any time you build a system that is designed to execute arbitrary code from the internet with an interactive user's credentials, you're not allowed to blame all your security problems on the operating system.

    jeez I'm not blaming the OS I'm just saying if people are not paying attention they will get caught. i think part of the responsibility is to the developper's and another part to the users.

     

    this signature system can't reject malicious modifications

    if thats not already done in forge, you could check that every player that logs in still have the original source/fingerprint of the mod and reject does that don't.

     

  2. i mean, saying forge isnt secure because of this is the same saying windows isnt secure because people are able to voluntarely install virus on their computer by downloading from bad locations... like yes it is an issue, but ..... theres not much we can/will do about it.

  3. right, but the thing is people have to know where they should know that they shouldn't get their mod from www.trolololhackerwarez.com and honestly since its java, any hacker could tottally re-sign the package. It's not hard. Best thing to do is distribute your mod from secure/valid locations and add a note or readme that says they shouldn't be getting it from anywhere else.

     

     

  4. well i don't have a tutorial, but i made some test with that and ill print you my classes.

     

    I ADMIT I COPY PASTED. i dont reaaally know what exactly is doing what and why.

     

    on a side note. i do know a lot about procedural generation and simplex/perlin noise, you *might* want to look at those before considering generating terrain as they are the source of minecraft terrain generation

     

    package com.hydroflame.dimension;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.world.WorldProviderEnd;
    import net.minecraftforge.common.DimensionManager;
    import net.minecraftforge.common.MinecraftForge;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.Init;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.Mod.PostInit;
    import cpw.mods.fml.common.Mod.PreInit;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPostInitializationEvent;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.common.registry.LanguageRegistry;
    
    @Mod(modid = "dimension", name = "Dimension Example", version = "EXAMPLE")
    public class Dimension {
    
        @Instance("dimension")
        public static Dimension instance;
    
        public static int dimensionID;
    
        public static Block dimensionBlock;
    
        @PreInit
        @SuppressWarnings("deprecation")
        public void preInit(FMLPreInitializationEvent event) {
        	dimensionID = DimensionManager.getNextFreeDimId();
            DimensionManager.registerProviderType(dimensionID, WorldProviderDimension.class, false);
            DimensionManager.registerDimension(dimensionID, dimensionID);
    
            dimensionBlock = new BlockDimensionBlock(499, Material.rock).setCreativeTab(CreativeTabs.tabBlock).setUnlocalizedName("blockDiamond");
            GameRegistry.registerBlock(dimensionBlock);
            LanguageRegistry.addName(dimensionBlock, "Dimension Block");
            
        }
    
        @Init
        public void init(FMLInitializationEvent event) {}
    
        @PostInit
        public void postInit(FMLPostInitializationEvent ecent) {}
    }

     

    package com.hydroflame.dimension;
    
    import net.minecraft.block.Block;
    import net.minecraft.entity.monster.EntityEnderman;
    import net.minecraft.world.biome.BiomeEndDecorator;
    import net.minecraft.world.biome.BiomeGenBase;
    import net.minecraft.world.biome.SpawnListEntry;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    
    public class BiomeGenAether extends BiomeGenBase{
    public BiomeGenAether(int par1)
        {
            super(par1);
            this.spawnableMonsterList.clear();
            this.spawnableCreatureList.clear();
            this.spawnableWaterCreatureList.clear();
            this.spawnableCaveCreatureList.clear();
            this.topBlock = (byte)Block.dirt.blockID;
            this.fillerBlock = (byte)Block.dirt.blockID;
        }
    
    
        /**
         * takes temperature, returns color
         */
        @SideOnly(Side.CLIENT)
        public int getSkyColorByTemp(float par1)
        {
            return 1;
        }
    }
    

     

    package com.hydroflame.dimension;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.material.Material;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.EntityPlayerMP;
    import net.minecraft.world.World;
    
    public class BlockDimensionBlock extends Block {
    
        public BlockDimensionBlock(int par1, Material par2Material) {
            super(par1, par2Material);
        }
    
        @Override
        /**
         * Called upon block activation (right click on the block.)
         */
        public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
            if (par5EntityPlayer.ridingEntity == null
                    && par5EntityPlayer.riddenByEntity == null) {
                if (par5EntityPlayer instanceof EntityPlayerMP) {
                    EntityPlayerMP thePlayer = (EntityPlayerMP) par5EntityPlayer;
                    if (par5EntityPlayer.dimension != Dimension.dimensionID) {
                        thePlayer.mcServer
                        .getConfigurationManager()
                        .transferPlayerToDimension(
                                thePlayer,
                                Dimension.dimensionID,
                                new TeleporterDimension(
                                        thePlayer.mcServer
                                        .worldServerForDimension(Dimension.dimensionID)));
                        return true;
                    } else {
                        thePlayer.mcServer.getConfigurationManager()
                        .transferPlayerToDimension(
                                thePlayer,
                                0,
                                new TeleporterDimension(thePlayer.mcServer
                                        .worldServerForDimension(0)));
                        return true;
                    }
                } else
                    return false;
            } else
                return false;
        }
    }

     

    package com.hydroflame.dimension;
    
    import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE;
    import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT;
    import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE;
    import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE;
    import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD;
    import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE;
    import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON;
    import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE;
    import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE;
    import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA;
    
    import java.util.List;
    import java.util.Random;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockSand;
    import net.minecraft.entity.EnumCreatureType;
    import net.minecraft.util.IProgressUpdate;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.ChunkPosition;
    import net.minecraft.world.SpawnerAnimals;
    import net.minecraft.world.World;
    import net.minecraft.world.biome.BiomeGenBase;
    import net.minecraft.world.chunk.Chunk;
    import net.minecraft.world.chunk.IChunkProvider;
    import net.minecraft.world.gen.MapGenBase;
    import net.minecraft.world.gen.MapGenCaves;
    import net.minecraft.world.gen.MapGenRavine;
    import net.minecraft.world.gen.NoiseGeneratorOctaves;
    import net.minecraft.world.gen.feature.MapGenScatteredFeature;
    import net.minecraft.world.gen.feature.WorldGenDungeons;
    import net.minecraft.world.gen.feature.WorldGenLakes;
    import net.minecraft.world.gen.structure.MapGenMineshaft;
    import net.minecraft.world.gen.structure.MapGenStronghold;
    import net.minecraft.world.gen.structure.MapGenVillage;
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.event.Event.Result;
    import net.minecraftforge.event.terraingen.ChunkProviderEvent;
    import net.minecraftforge.event.terraingen.PopulateChunkEvent;
    import net.minecraftforge.event.terraingen.TerrainGen;
    
    public class ChunkManagerDimension implements IChunkProvider {
    
        /** RNG. */
        private Random rand;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        private NoiseGeneratorOctaves noiseGen1;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        private NoiseGeneratorOctaves noiseGen2;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        private NoiseGeneratorOctaves noiseGen3;
    
        /** A NoiseGeneratorOctaves used in generating terrain */
        private NoiseGeneratorOctaves noiseGen4;
    
        /** 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;
    
        /**
         * Holds the overall noise array used in chunk
         * generation
         */
        private double[] noiseArray;
        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;
    
        /**
         * A double array that hold terrain noise from noiseGen3
         */
        double[] noise3;
    
        /** A double array that hold terrain noise */
        double[] noise1;
    
        /**
         * A double array that hold terrain noise from noiseGen2
         */
        double[] noise2;
    
        /**
         * A double array that hold terrain noise from noiseGen5
         */
        double[] noise5;
    
        /**
         * A double array that holds terrain noise from
         * noiseGen6
         */
        double[] noise6;
    
        /**
         * Used to store the 5x5 parabolic field that is used
         * during terrain generation.
         */
        float[] parabolicField;
        int[][] field_73219_j = new int[32][32];
    
        {
            caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
            strongholdGenerator = (MapGenStronghold) TerrainGen.getModdedMapGen(
                    strongholdGenerator, STRONGHOLD);
            villageGenerator = (MapGenVillage) TerrainGen.getModdedMapGen(
                    villageGenerator, VILLAGE);
            mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(
                    mineshaftGenerator, MINESHAFT);
            scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen
                    .getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);
            ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE);
        }
    
        public ChunkManagerDimension(World par1World, long par2, boolean par4) {
            this.worldObj = par1World;
            this.mapFeaturesEnabled = par4;
            this.rand = new Random(par2);
            this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16);
            this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16);
            this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, ;
            this.noiseGen4 = new NoiseGeneratorOctaves(this.rand, 4);
            this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
            this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
            this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, ;
    
            NoiseGeneratorOctaves[] noiseGens = { noiseGen1, noiseGen2, noiseGen3,
                    noiseGen4, noiseGen5, noiseGen6, mobSpawnerNoise };
            noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand,
                    noiseGens);
            this.noiseGen1 = noiseGens[0];
            this.noiseGen2 = noiseGens[1];
            this.noiseGen3 = noiseGens[2];
            this.noiseGen4 = noiseGens[3];
            this.noiseGen5 = noiseGens[4];
            this.noiseGen6 = noiseGens[5];
            this.mobSpawnerNoise = noiseGens[6];
        }
    
        /**
         * Returns if the IChunkProvider supports saving.
         */
        @Override
        public boolean canSave() {
            return true;
        }
    
        /**
         * Checks to see if a chunk exists at x, y
         */
        @Override
        public boolean chunkExists(int par1, int par2) {
            return true;
        }
    
        /**
         * Returns the location of the closest structure of the
         * specified type. If not found returns null.
         */
        @Override
        public ChunkPosition findClosestStructure(World par1World, String par2Str,
                int par3, int par4, int par5) {
            return "Stronghold".equals(par2Str) && this.strongholdGenerator != null ? this.strongholdGenerator
                    .getNearestInstance(par1World, par3, par4, par5) : null;
        }
    
        @Override
        public void func_104112_b() {
    
        }
    
        /**
         * Generates the shape of the terrain for the chunk
         * though its all stone though the water is frozen if
         * the temperature is low enough
         */
        public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) {
            byte var4 = 4;
            byte var5 = 16;
            byte var6 = 63;
            int var7 = var4 + 1;
            byte var8 = 17;
            int var9 = var4 + 1;
            this.biomesForGeneration = this.worldObj.getWorldChunkManager()
                    .getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2,
                            par2 * 4 - 2, var7 + 5, var9 + 5);
            this.noiseArray = this.initializeNoiseField(this.noiseArray, par1
                    * var4, 0, par2 * var4, var7, var8, var9);
    
            for (int var10 = 0; var10 < var4; ++var10) {
                for (int var11 = 0; var11 < var4; ++var11) {
                    for (int var12 = 0; var12 < var5; ++var12) {
                        double var13 = 0.125D;
                        double var15 = this.noiseArray[((var10 + 0) * var9 + var11 + 0)
                                * var8 + var12 + 0];
                        double var17 = this.noiseArray[((var10 + 0) * var9 + var11 + 1)
                                * var8 + var12 + 0];
                        double var19 = this.noiseArray[((var10 + 1) * var9 + var11 + 0)
                                * var8 + var12 + 0];
                        double var21 = this.noiseArray[((var10 + 1) * var9 + var11 + 1)
                                * var8 + var12 + 0];
                        double var23 = (this.noiseArray[((var10 + 0) * var9 + var11 + 0)
                                * var8 + var12 + 1] - var15)
                                * var13;
                        double var25 = (this.noiseArray[((var10 + 0) * var9 + var11 + 1)
                                * var8 + var12 + 1] - var17)
                                * var13;
                        double var27 = (this.noiseArray[((var10 + 1) * var9 + var11 + 0)
                                * var8 + var12 + 1] - var19)
                                * var13;
                        double var29 = (this.noiseArray[((var10 + 1) * var9 + var11 + 1)
                                * var8 + var12 + 1] - var21)
                                * var13;
    
                        for (int var31 = 0; var31 < 8; ++var31) {
                            double var32 = 0.25D;
                            double var34 = var15;
                            double var36 = var17;
                            double var38 = (var19 - var15) * var32;
                            double var40 = (var21 - var17) * var32;
    
                            for (int var42 = 0; var42 < 4; ++var42) {
                                int var43 = var42 + var10 * 4 << 11
                                        | 0 + var11 * 4 << 7 | var12 * 8 + var31;
                                short var44 = 128;
                                var43 -= var44;
                                double var45 = 0.25D;
                                double var49 = (var36 - var34) * var45;
                                double var47 = var34 - var49;
    
                                for (int var51 = 0; var51 < 4; ++var51) {
                                    if ((var47 += var49) > 0.0D) {
                                        par3ArrayOfByte[var43 += var44] = (byte) Block.ice.blockID;
                                    } else if (var12 * 8 + var31 < var6) {
                                        par3ArrayOfByte[var43 += var44] = (byte) Block.ice.blockID;
                                    } else {
                                        par3ArrayOfByte[var43 += var44] = 0;
                                    }
                                }
    
                                var34 += var38;
                                var36 += var40;
                            }
    
                            var15 += var23;
                            var17 += var25;
                            var19 += var27;
                            var21 += var29;
                        }
                    }
                }
            }
        }
    
        @Override
        public int getLoadedChunkCount() {
            return 0;
        }
    
        /**
         * Returns a list of creatures of the specified type
         * that can spawn at the given location.
         */
        @Override
        @SuppressWarnings("rawtypes")
        public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType,
                int par2, int par3, int par4) {
            BiomeGenBase var5 = this.worldObj.getBiomeGenForCoords(par2, par4);
            return var5 == null ? null : (var5 == BiomeGenBase.swampland
                    && par1EnumCreatureType == EnumCreatureType.monster
                    && this.scatteredFeatureGenerator.hasStructureAt(par2, par3,
                            par4) ? this.scatteredFeatureGenerator
                    .getScatteredFeatureSpawnList() : var5
                    .getSpawnableList(par1EnumCreatureType));
        }
    
        /**
         * generates a subset of the level's terrain data. Takes
         * 7 arguments: the [empty] noise array, the position,
         * and the size.
         */
        private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2,
                int par3, int par4, int par5, int par6, int par7) {
            ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(
                    this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
            MinecraftForge.EVENT_BUS.post(event);
            if (event.getResult() == Result.DENY)
                return event.noisefield;
    
            if (par1ArrayOfDouble == null) {
                par1ArrayOfDouble = new double[par5 * par6 * par7];
            }
    
            if (this.parabolicField == null) {
                this.parabolicField = new float[25];
    
                for (int var8 = -2; var8 <= 2; ++var8) {
                    for (int var9 = -2; var9 <= 2; ++var9) {
                        float var10 = 10.0F / MathHelper.sqrt_float(var8 * var8
                                + var9 * var9 + 0.2F);
                        this.parabolicField[var8 + 2 + (var9 + 2) * 5] = var10;
                    }
                }
            }
    
            double var44 = 684.412D;
            double var45 = 684.412D;
            this.noise5 = this.noiseGen5.generateNoiseOctaves(this.noise5, par2,
                    par4, par5, par7, 1.121D, 1.121D, 0.5D);
            this.noise6 = this.noiseGen6.generateNoiseOctaves(this.noise6, par2,
                    par4, par5, par7, 200.0D, 200.0D, 0.5D);
            this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, par2,
                    par3, par4, par5, par6, par7, var44 / 80.0D, var45 / 160.0D,
                    var44 / 80.0D);
            this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, par2,
                    par3, par4, par5, par6, par7, var44, var45, var44);
            this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, par2,
                    par3, par4, par5, par6, par7, var44, var45, var44);
            int var12 = 0;
            int var13 = 0;
    
            for (int var14 = 0; var14 < par5; ++var14) {
                for (int var15 = 0; var15 < par7; ++var15) {
                    float var16 = 0.0F;
                    float var17 = 0.0F;
                    float var18 = 0.0F;
                    byte var19 = 2;
                    BiomeGenBase var20 = this.biomesForGeneration[var14 + 2
                            + (var15 + 2) * (par5 + 5)];
    
                    for (int var21 = -var19; var21 <= var19; ++var21) {
                        for (int var22 = -var19; var22 <= var19; ++var22) {
                            BiomeGenBase var23 = this.biomesForGeneration[var14
                                    + var21 + 2 + (var15 + var22 + 2) * (par5 + 5)];
                            float var24 = this.parabolicField[var21 + 2
                                    + (var22 + 2) * 5]
                                    / (var23.minHeight + 2.0F);
    
                            if (var23.minHeight > var20.minHeight) {
                                var24 /= 2.0F;
                            }
    
                            var16 += var23.maxHeight * var24;
                            var17 += var23.minHeight * var24;
                            var18 += var24;
                        }
                    }
    
                    var16 /= var18;
                    var17 /= var18;
                    var16 = var16 * 0.9F + 0.1F;
                    var17 = (var17 * 4.0F - 1.0F) / 8.0F;
                    double var47 = this.noise6[var13] / 8000.0D;
    
                    if (var47 < 0.0D) {
                        var47 = -var47 * 0.3D;
                    }
    
                    var47 = var47 * 3.0D - 2.0D;
    
                    if (var47 < 0.0D) {
                        var47 /= 2.0D;
    
                        if (var47 < -1.0D) {
                            var47 = -1.0D;
                        }
    
                        var47 /= 1.4D;
                        var47 /= 2.0D;
                    } else {
                        if (var47 > 1.0D) {
                            var47 = 1.0D;
                        }
    
                        var47 /= 8.0D;
                    }
    
                    ++var13;
    
                    for (int var46 = 0; var46 < par6; ++var46) {
                        double var48 = var17;
                        double var26 = var16;
                        var48 += var47 * 0.2D;
                        var48 = var48 * par6 / 16.0D;
                        double var28 = par6 / 2.0D + var48 * 4.0D;
                        double var30 = 0.0D;
                        double var32 = (var46 - var28) * 12.0D * 128.0D / 128.0D
                                / var26;
    
                        if (var32 < 0.0D) {
                            var32 *= 4.0D;
                        }
    
                        double var34 = this.noise1[var12] / 512.0D;
                        double var36 = this.noise2[var12] / 512.0D;
                        double var38 = (this.noise3[var12] / 10.0D + 1.0D) / 2.0D;
    
                        if (var38 < 0.0D) {
                            var30 = var34;
                        } else if (var38 > 1.0D) {
                            var30 = var36;
                        } else {
                            var30 = var34 + (var36 - var34) * var38;
                        }
    
                        var30 -= var32;
    
                        if (var46 > par6 - 4) {
                            double var40 = (var46 - (par6 - 4)) / 3.0F;
                            var30 = var30 * (1.0D - var40) + -10.0D * var40;
                        }
    
                        par1ArrayOfDouble[var12] = var30;
                        ++var12;
                    }
                }
            }
    
            return par1ArrayOfDouble;
        }
    
        /**
         * loads or generates the chunk at the chunk location
         * specified
         */
        @Override
        public Chunk loadChunk(int par1, int par2) {
            return this.provideChunk(par1, par2);
        }
    
        /**
         * Converts the instance data to a readable string.
         */
        @Override
        public String makeString() {
            return "RandomLevelSource";
        }
    
        /**
         * Populates chunk with ores etc etc
         */
        @Override
        public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
    
            BlockSand.fallInstantly = true;
            int var4 = par2 * 16;
            int var5 = par3 * 16;
            BiomeGenBase var6 = this.worldObj.getBiomeGenForCoords(var4 + 16,
                    var5 + 16);
            this.rand.setSeed(this.worldObj.getSeed());
            long var7 = this.rand.nextLong() / 2L * 2L + 1L;
            long var9 = this.rand.nextLong() / 2L * 2L + 1L;
            this.rand.setSeed(par2 * var7 + par3 * var9 ^ this.worldObj.getSeed());
            boolean var11 = false;
    
            MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(
                    par1IChunkProvider, worldObj, rand, par2, par3, var11));
    
            if (this.mapFeaturesEnabled) {
                this.mineshaftGenerator.generateStructuresInChunk(this.worldObj,
                        this.rand, par2, par3);
                var11 = this.villageGenerator.generateStructuresInChunk(
                        this.worldObj, this.rand, par2, par3);
                this.strongholdGenerator.generateStructuresInChunk(this.worldObj,
                        this.rand, par2, par3);
                this.scatteredFeatureGenerator.generateStructuresInChunk(
                        this.worldObj, this.rand, par2, par3);
            }
    
            int var12;
            int var13;
            int var14;
    
            if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3,
                    var11, LAKE) && !var11 && this.rand.nextInt(4) == 0) {
                var12 = var4 + this.rand.nextInt(16) + 8;
                var13 = this.rand.nextInt(128);
                var14 = var5 + this.rand.nextInt(16) + 8;
                (new WorldGenLakes(Block.ice.blockID)).generate(
                        this.worldObj, this.rand, var12, var13, var14);
            }
    
            if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3,
                    var11, LAVA) && !var11 && this.rand.nextInt( == 0) {
                var12 = var4 + this.rand.nextInt(16) + 8;
                var13 = this.rand.nextInt(this.rand.nextInt(120) + ;
                var14 = var5 + this.rand.nextInt(16) + 8;
    
                if (var13 < 63 || this.rand.nextInt(10) == 0) {
                    (new WorldGenLakes(Block.lavaStill.blockID)).generate(
                            this.worldObj, this.rand, var12, var13, var14);
                }
            }
    
            boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand,
                    par2, par3, var11, DUNGEON);
            for (var12 = 0; doGen && var12 < 8; ++var12) {
                var13 = var4 + this.rand.nextInt(16) + 8;
                var14 = this.rand.nextInt(128);
                int var15 = var5 + this.rand.nextInt(16) + 8;
    
                if ((new WorldGenDungeons()).generate(this.worldObj, this.rand,
                        var13, var14, var15)) {
                    ;
                }
            }
    
            var6.decorate(this.worldObj, this.rand, var4, var5);
            SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8,
                    var5 + 8, 16, 16, this.rand);
            var4 += 8;
            var5 += 8;
    
            doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2,
                    par3, var11, ICE);
            for (var12 = 0; doGen && var12 < 16; ++var12) {
                for (var13 = 0; var13 < 16; ++var13) {
                    var14 = this.worldObj.getPrecipitationHeight(var4 + var12, var5
                            + var13);
    
                    if (this.worldObj.isBlockFreezable(var12 + var4, var14 - 1,
                            var13 + var5)) {
                        this.worldObj.setBlock(var12 + var4, var14 - 1, var13
                                + var5, Block.ice.blockID, 2, 2);
                    }
    
                    if (this.worldObj.canSnowAt(var12 + var4, var14, var13 + var5)) {
                        this.worldObj.setBlock(var12 + var4, var14, var13 + var5,
                                Block.snow.blockID, 2, 2);
                    }
                }
            }
    
            MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(
                    par1IChunkProvider, worldObj, rand, par2, par3, var11));
    
            BlockSand.fallInstantly = false;
        }
    
        /**
         * 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);
            byte[] var3 = new byte[32768];
            this.generateTerrain(par1, par2, var3);
            this.biomesForGeneration = this.worldObj.getWorldChunkManager()
                    .loadBlockGeneratorData(this.biomesForGeneration, par1 * 16,
                            par2 * 16, 16, 16);
            this.replaceBlocksForBiome(par1, par2, var3, this.biomesForGeneration);
            this.caveGenerator.generate(this, this.worldObj, par1, par2, var3);
            this.ravineGenerator.generate(this, this.worldObj, par1, par2, var3);
    
            if (this.mapFeaturesEnabled) {
                this.mineshaftGenerator.generate(this, this.worldObj, par1, par2,
                        var3);
                this.villageGenerator.generate(this, this.worldObj, par1, par2,
                        var3);
                this.strongholdGenerator.generate(this, this.worldObj, par1, par2,
                        var3);
                this.scatteredFeatureGenerator.generate(this, this.worldObj, par1,
                        par2, var3);
            }
    
            Chunk var4 = new Chunk(this.worldObj, var3, par1, par2);
            byte[] var5 = var4.getBiomeArray();
    
            for (int var6 = 0; var6 < var5.length; ++var6) {
                var5[var6] = (byte) this.biomesForGeneration[var6].biomeID;
            }
    
            var4.generateSkylightMap();
            return var4;
        }
    
        @Override
        public void recreateStructures(int par1, int par2) {
            if (this.mapFeaturesEnabled) {
                this.mineshaftGenerator.generate(this, this.worldObj, par1, par2,
                        (byte[]) null);
                this.villageGenerator.generate(this, this.worldObj, par1, par2,
                        (byte[]) null);
                this.strongholdGenerator.generate(this, this.worldObj, par1, par2,
                        (byte[]) null);
                this.scatteredFeatureGenerator.generate(this, this.worldObj, par1,
                        par2, (byte[]) null);
            }
        }
    
        /**
         * Replaces the stone that was placed in with blocks
         * that match the biome
         */
        public void replaceBlocksForBiome(int par1, int par2,
                byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) {
            ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(
                    this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase);
            MinecraftForge.EVENT_BUS.post(event);
            if (event.getResult() == Result.DENY)
                return;
    
            byte var5 = 63;
            double var6 = 0.03125D;
            this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise,
                    par1 * 16, par2 * 16, 0, 16, 16, 1, var6 * 2.0D, var6 * 2.0D,
                    var6 * 2.0D);
    
            for (int var8 = 0; var8 < 16; ++var8) {
                for (int var9 = 0; var9 < 16; ++var9) {
                    BiomeGenBase var10 = par4ArrayOfBiomeGenBase[var9 + var8 * 16];
                    float var11 = var10.getFloatTemperature();
                    int var12 = (int) (this.stoneNoise[var8 + var9 * 16] / 3.0D + 3.0D + this.rand
                            .nextDouble() * 0.25D);
                    int var13 = -1;
                    byte var14 = var10.topBlock;
                    byte var15 = var10.fillerBlock;
    
                    for (int var16 = 127; var16 >= 0; --var16) {
                        int var17 = (var9 * 16 + var8) * 128 + var16;
    
                        if (var16 <= 0 + this.rand.nextInt(5)) {
                            par3ArrayOfByte[var17] = (byte) Block.bedrock.blockID;
                        } else {
                            byte var18 = par3ArrayOfByte[var17];
    
                            if (var18 == 0) {
                                var13 = -1;
                            } else if (var18 == Block.ice.blockID) {
                                if (var13 == -1) {
                                    if (var12 <= 0) {
                                        var14 = 0;
                                        var15 = (byte) Block.ice.blockID;
                                    } else if (var16 >= var5 - 4
                                            && var16 <= var5 + 1) {
                                        var14 = var10.topBlock;
                                        var15 = var10.fillerBlock;
                                    }
    
                                    if (var16 < var5 && var14 == 0) {
                                        // this has to do with
                                        // temperatures, make
                                        // them the same to be
                                        // the same no matter
                                        // what temperature
                                        if (var11 < 0.15F) {
                                            var14 = (byte) Block.ice.blockID;
                                        } else {
                                            var14 = (byte) Block.ice.blockID;
                                        }
                                    }
    
                                    var13 = var12;
    
                                    if (var16 >= var5 - 1) {
                                        par3ArrayOfByte[var17] = var14;
                                    } else {
                                        par3ArrayOfByte[var17] = var15;
                                    }
                                } else if (var13 > 0) {
                                    --var13;
                                    par3ArrayOfByte[var17] = var15;
    
                                    if (var13 == 0 && var15 == Block.sand.blockID) {
                                        var13 = this.rand.nextInt(4);
                                        var15 = (byte) Block.sandStone.blockID;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    
        /**
         * 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;
        }
    
        /**
         * Unloads the 100 oldest chunks from memory, due to a
         * bug with chunkSet.add() never being called it thinks
         * the list is always empty and will not remove any
         * chunks.
         */
        public boolean unload100OldestChunks() {
            return false;
        }
    
        @Override
        public boolean unloadQueuedChunks() {
            return false;
        }
    }
    

     

    package com.hydroflame.dimension;
    
    import java.util.List;
    import java.util.Random;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockSand;
    import net.minecraft.entity.EnumCreatureType;
    import net.minecraft.util.IProgressUpdate;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.ChunkPosition;
    import net.minecraft.world.World;
    import net.minecraft.world.biome.BiomeGenBase;
    import net.minecraft.world.chunk.Chunk;
    import net.minecraft.world.chunk.IChunkProvider;
    import net.minecraft.world.gen.NoiseGeneratorOctaves;
    import net.minecraftforge.common.MinecraftForge;
    import net.minecraftforge.event.Event.Result;
    import net.minecraftforge.event.terraingen.ChunkProviderEvent;
    import net.minecraftforge.event.terraingen.PopulateChunkEvent;
    import net.minecraftforge.event.terraingen.TerrainGen;
    
    public class ChunkProviderAether implements IChunkProvider{
        private Random endRNG;
        private NoiseGeneratorOctaves noiseGen1;
        private NoiseGeneratorOctaves noiseGen2;
        private NoiseGeneratorOctaves noiseGen3;
        public NoiseGeneratorOctaves noiseGen4;
        public NoiseGeneratorOctaves noiseGen5;
        private World endWorld;
        private double[] densities;
    
        /** The biomes that are used to generate the chunk */
        private BiomeGenBase[] biomesForGeneration;
        double[] noiseData1;
        double[] noiseData2;
        double[] noiseData3;
        double[] noiseData4;
        double[] noiseData5;
        int[][] field_73203_h = new int[32][32];
    
        public ChunkProviderAether(World par1World, long par2)
        {
            this.endWorld = par1World;
            this.endRNG = new Random(par2);
            this.noiseGen1 = new NoiseGeneratorOctaves(this.endRNG, 16);
            this.noiseGen2 = new NoiseGeneratorOctaves(this.endRNG, 16);
            this.noiseGen3 = new NoiseGeneratorOctaves(this.endRNG, ;
            this.noiseGen4 = new NoiseGeneratorOctaves(this.endRNG, 10);
            this.noiseGen5 = new NoiseGeneratorOctaves(this.endRNG, 16);
    
            NoiseGeneratorOctaves[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noiseGen4, noiseGen5};
            noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.endRNG, noiseGens);
            this.noiseGen1 = noiseGens[0];
            this.noiseGen2 = noiseGens[1];
            this.noiseGen3 = noiseGens[2];
            this.noiseGen4 = noiseGens[3];
            this.noiseGen5 = noiseGens[4];
       }
    
        public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
        {
            byte b0 = 2;
            int k = b0 + 1;
            byte b1 = 33;
            int l = b0 + 1;
            this.densities = this.initializeNoiseField(this.densities, par1 * b0, 0, par2 * b0, k, b1, l);
    
            for (int i1 = 0; i1 < b0; ++i1)
            {
                for (int j1 = 0; j1 < b0; ++j1)
                {
                    for (int k1 = 0; k1 < 32; ++k1)
                    {
                        double d0 = 0.05D;
                        double d1 = this.densities[((i1 + 0) * l + j1 + 0) * b1 + k1 + 0];
                        double d2 = this.densities[((i1 + 0) * l + j1 + 1) * b1 + k1 + 0];
                        double d3 = this.densities[((i1 + 1) * l + j1 + 0) * b1 + k1 + 0];
                        double d4 = this.densities[((i1 + 1) * l + j1 + 1) * b1 + k1 + 0];
                        double d5 = (this.densities[((i1 + 0) * l + j1 + 0) * b1 + k1 + 1] - d1) * d0;
                        double d6 = (this.densities[((i1 + 0) * l + j1 + 1) * b1 + k1 + 1] - d2) * d0;
                        double d7 = (this.densities[((i1 + 1) * l + j1 + 0) * b1 + k1 + 1] - d3) * d0;
                        double d8 = (this.densities[((i1 + 1) * l + j1 + 1) * b1 + k1 + 1] - d4) * d0;
    
                        for (int l1 = 0; l1 < 4; ++l1)
                        {
                            double d9 = 0.125D;
                            double d10 = d1;
                            double d11 = d2;
                            double d12 = (d3 - d1) * d9;
                            double d13 = (d4 - d2) * d9;
    
                            for (int i2 = 0; i2 < 8; ++i2)
                            {
                                int j2 = i2 + i1 * 8 << 11 | 0 + j1 * 8 << 7 | k1 * 4 + l1;
                                short short1 = 128;
                                double d14 = 0.125D;
                                double d15 = d10;
                                double d16 = (d11 - d10) * d14;
    
                                for (int k2 = 0; k2 < 8; ++k2)
                                {
                                    int l2 = 0;
    
                                    if (d15 > 0.0D)
                                    {
                                        l2 = Block.stone.blockID;
                                    }
    
                                    par3ArrayOfByte[j2] = (byte)l2;
                                    j2 += short1;
                                    d15 += d16;
                                }
    
                                d10 += d12;
                                d11 += d13;
                            }
    
                            d1 += d5;
                            d2 += d6;
                            d3 += d7;
                            d4 += d8;
                        }
                    }
                }
            }
        }
    
        public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
        {
            ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase);
            MinecraftForge.EVENT_BUS.post(event);
            if (event.getResult() == Result.DENY) return;
    
            for (int k = 0; k < 16; ++k)
            {
                for (int l = 0; l < 16; ++l)
                {
                    byte b0 = 1;
                    int i1 = -1;
                    byte b1 = (byte)Block.stone.blockID;
                    byte b2 = (byte)Block.stone.blockID;
    
                    for (int j1 = 127; j1 >= 0; --j1)
                    {
                        int k1 = (l * 16 + k) * 128 + j1;
                        byte b3 = par3ArrayOfByte[k1];
    
                        if (b3 == 0)
                        {
                            i1 = -1;
                        }
                        else if (b3 == Block.stone.blockID)
                        {
                            if (i1 == -1)
                            {
                                if (b0 <= 0)
                                {
                                    b1 = 0;
                                    b2 = (byte)Block.stone.blockID;
                                }
    
                                i1 = b0;
    
                                if (j1 >= 0)
                                {
                                    par3ArrayOfByte[k1] = b1;
                                }
                                else
                                {
                                    par3ArrayOfByte[k1] = b2;
                                }
                            }
                            else if (i1 > 0)
                            {
                                --i1;
                                par3ArrayOfByte[k1] = b2;
                            }
                        }
                    }
                }
            }
        }
    
        /**
         * loads or generates the chunk at the chunk location specified
         */
        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
         */
        public Chunk provideChunk(int par1, int par2)
        {
            this.endRNG.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
            byte[] abyte = new byte[32768];
            this.biomesForGeneration = this.endWorld.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
            this.generateTerrain(par1, par2, abyte, this.biomesForGeneration);
            this.replaceBlocksForBiome(par1, par2, abyte, this.biomesForGeneration);
            Chunk chunk = new Chunk(this.endWorld, 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.
         */
        private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)
        {
            ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7);
            MinecraftForge.EVENT_BUS.post(event);
            if (event.getResult() == Result.DENY) return event.noisefield;
    
            if (par1ArrayOfDouble == null)
            {
                par1ArrayOfDouble = new double[par5 * par6 * par7];
            }
    
            double d0 = 684.412D;
            double d1 = 684.412D;
            this.noiseData4 = this.noiseGen4.generateNoiseOctaves(this.noiseData4, par2, par4, par5, par7, 1.121D, 1.121D, 0.5D);
            this.noiseData5 = this.noiseGen5.generateNoiseOctaves(this.noiseData5, par2, par4, par5, par7, 200.0D, 200.0D, 0.5D);
            d0 *= 2.0D;
            this.noiseData1 = this.noiseGen3.generateNoiseOctaves(this.noiseData1, par2, par3, par4, par5, par6, par7, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D);
            this.noiseData2 = this.noiseGen1.generateNoiseOctaves(this.noiseData2, par2, par3, par4, par5, par6, par7, d0, d1, d0);
            this.noiseData3 = this.noiseGen2.generateNoiseOctaves(this.noiseData3, par2, par3, par4, par5, par6, par7, d0, d1, d0);
            int k1 = 0;
            int l1 = 0;
    
            for (int i2 = 0; i2 < par5; ++i2)
            {
                for (int j2 = 0; j2 < par7; ++j2)
                {
                    double d2 = (this.noiseData4[l1] + 256.0D) / 512.0D;
    
                    if (d2 > 1.0D)
                    {
                        d2 = 1.0D;
                    }
    
                    double d3 = this.noiseData5[l1] / 8000.0D;
    
                    if (d3 < 0.0D)
                    {
                        d3 = -d3 * 0.3D;
                    }
    
                    d3 = d3 * 3.0D - 2.0D;
                    float f = (float)(i2 + par2 - 0) / 1.0F;
                    float f1 = (float)(j2 + par4 - 0) / 1.0F;
                    float f2 = 100.0F - MathHelper.sqrt_float(f * f + f1 * f1) * 8.0F;
    
                    if (f2 > 80.0F)
                    {
                        f2 = 80.0F;
                    }
    
                    if (f2 < -100.0F)
                    {
                        f2 = -100.0F;
                    }
    
                    if (d3 > 1.0D)
                    {
                        d3 = 1.0D;
                    }
    
                    d3 /= 8.0D;
                    d3 = 0.0D;
    
                    if (d2 < 0.0D)
                    {
                        d2 = 0.0D;
                    }
    
                    d2 += 0.5D;
                    d3 = d3 * (double)par6 / 16.0D;
                    ++l1;
                    double d4 = (double)par6 / 2.0D;
    
                    for (int k2 = 0; k2 < par6; ++k2)
                    {
                        double d5 = 0.0D;
                        double d6 = ((double)k2 - d4) * 8.0D / d2;
    
                        if (d6 < 0.0D)
                        {
                            d6 *= -1.0D;
                        }
    
                        double d7 = this.noiseData2[k1] / 512.0D;
                        double d8 = this.noiseData3[k1] / 512.0D;
                        double d9 = (this.noiseData1[k1] / 10.0D + 1.0D) / 2.0D;
    
                        if (d9 < 0.0D)
                        {
                            d5 = d7;
                        }
                        else if (d9 > 1.0D)
                        {
                            d5 = d8;
                        }
                        else
                        {
                            d5 = d7 + (d8 - d7) * d9;
                        }
    
                        d5 -= 8.0D;
                        d5 += (double)f2;
                        byte b0 = 2;
                        double d10;
    
                        if (k2 > par6 / 2 - b0)
                        {
                            d10 = (double)((float)(k2 - (par6 / 2 - b0)) / 64.0F);
    
                            if (d10 < 0.0D)
                            {
                                d10 = 0.0D;
                            }
    
                            if (d10 > 1.0D)
                            {
                                d10 = 1.0D;
                            }
    
                            d5 = d5 * (1.0D - d10) + -3000.0D * d10;
                        }
    
                        b0 = 8;
    
                        if (k2 < b0)
                        {
                            d10 = (double)((float)(b0 - k2) / ((float)b0 - 1.0F));
                            d5 = d5 * (1.0D - d10) + -30.0D * d10;
                        }
    
                        par1ArrayOfDouble[k1] = d5;
                        ++k1;
                    }
                }
            }
    
            return par1ArrayOfDouble;
        }
    
        /**
         * Checks to see if a chunk exists at x, y
         */
        public boolean chunkExists(int par1, int par2)
        {
            return true;
        }
    
        /**
         * Populates chunk with ores etc etc
         */
        public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
        {
            BlockSand.fallInstantly = true;
    
            MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false));
    
            int k = par2 * 16;
            int l = par3 * 16;
            BiomeGenBase biomegenbase = this.endWorld.getBiomeGenForCoords(k + 16, l + 16);
            biomegenbase.decorate(this.endWorld, this.endWorld.rand, k, l);
    
            MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, endWorld, endWorld.rand, par2, par3, false));
    
            BlockSand.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.
         */
        public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
        {
            return true;
        }
    
        public void func_104112_b() {}
    
        /**
         * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
         */
        public boolean unloadQueuedChunks()
        {
            return false;
        }
    
        /**
         * Returns if the IChunkProvider supports saving.
         */
        public boolean canSave()
        {
            return true;
        }
    
        /**
         * Converts the instance data to a readable string.
         */
        public String makeString()
        {
            return "RandomLevelSource";
        }
    
        /**
         * Returns a list of creatures of the specified type that can spawn at the given location.
         */
        public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
        {
        	return null;
        }
    
        /**
         * Returns the location of the closest structure of the specified type. If not found returns null.
         */
        public ChunkPosition findClosestStructure(World par1World, String par2Str, int par3, int par4, int par5)
        {
            return null;
        }
    
        public int getLoadedChunkCount()
        {
            return 0;
        }
    
        public void recreateStructures(int par1, int par2) {}
    
    
    }
    

     

    package com.hydroflame.dimension;
    
    import net.minecraft.entity.Entity;
    import net.minecraft.world.Teleporter;
    import net.minecraft.world.WorldServer;
    
    public class TeleporterDimension extends Teleporter {
    
        public TeleporterDimension(WorldServer par1WorldServer) {
            super(par1WorldServer);
        }
    
        @Override
        public boolean makePortal(Entity par1Entity) {
            
            return true;
        }
    
        @Override
        public boolean placeInExistingPortal(Entity par1Entity, double par2,
                double par4, double par6, float par8) {
            return false;
        }
    }

     

    package com.hydroflame.dimension;
    
    import net.minecraft.block.Block;
    import net.minecraft.util.ChunkCoordinates;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.WorldProvider;
    import net.minecraft.world.biome.WorldChunkManagerHell;
    import net.minecraft.world.chunk.IChunkProvider;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    
    public class WorldProviderDimension extends WorldProvider {
    
    /**
         * creates a new world chunk manager for WorldProvider
         */
        public void registerWorldChunkManager()
        {
            this.worldChunkMgr = new WorldChunkManagerHell(new BiomeGenAether(23), 0.5F, 0.0F);
            this.dimensionId = 1;
            this.hasNoSky = false;
        }
    
        /**
         * Returns a new chunk provider which generates chunks for this world
         */
        public IChunkProvider createChunkGenerator()
        {
            return new ChunkProviderAether(this.worldObj, this.worldObj.getSeed());
        }
    
        /**
         * Calculates the angle of sun and moon in the sky relative to a specified time (usually worldTime)
         */
        public float calculateCelestialAngle(long par1, float par3)
        {
            return 0.0F;
        }
    
        @SideOnly(Side.CLIENT)
    
        /**
         * Returns array with sunrise/sunset colors
         */
        public float[] calcSunriseSunsetColors(float par1, float par2)
        {
            return new float[]{1, 1, 1, 1};
        }
    
        @SideOnly(Side.CLIENT)
    
        /**
         * Return Vec3D with biome specific fog color
         */
        public Vec3 getFogColor(float par1, float par2)
        {
            int i = 10518688;
            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 = (float)(i >> 16 & 255) / 255.0F;
            float f4 = (float)(i >> 8 & 255) / 255.0F;
            float f5 = (float)(i & 255) / 255.0F;
            f3 *= f2 * 0.0F + 0.15F;
            f4 *= f2 * 0.0F + 0.15F;
            f5 *= f2 * 0.0F + 0.15F;
            return this.worldObj.getWorldVec3Pool().getVecFromPool((double)f3, (double)f4, (double)f5);
        }
    
        @SideOnly(Side.CLIENT)
        public boolean isSkyColored()
        {
            return true;
        }
    
        /**
         * True if the player can respawn in this dimension (true = overworld, false = nether).
         */
        public boolean canRespawnHere()
        {
            return false;
        }
    
        /**
         * Returns 'true' if in the "main surface world", but 'false' if in the Nether or End dimensions.
         */
        public boolean isSurfaceWorld()
        {
            return true;
        }
    
        @SideOnly(Side.CLIENT)
    
        /**
         * the y level at which clouds are rendered.
         */
        public float getCloudHeight()
        {
            return 128.0F;
        }
    
        /**
         * Will check if the x, z position specified is alright to be set as the map spawn point
         */
        public boolean canCoordinateBeSpawn(int par1, int par2)
        {
            int k = this.worldObj.getFirstUncoveredBlock(par1, par2);
            return k == 0 ? false : Block.blocksList[k].blockMaterial.blocksMovement();
        }
    
        /**
         * Gets the hard-coded portal location to use when entering this dimension.
         */
        public ChunkCoordinates getEntrancePortalLocation()
        {
            return new ChunkCoordinates(100, 50, 0);
        }
    
        public int getAverageGroundLevel()
        {
            return 50;
        }
    
        @SideOnly(Side.CLIENT)
    
        /**
         * Returns true if the given X,Z coordinate should show environmental fog.
         */
        public boolean doesXZShowFog(int par1, int par2)
        {
            return false;
        }
    
        /**
         * Returns the dimension's name, e.g. "The End", "Nether", or "Overworld".
         */
        public String getDimensionName()
        {
            return "Aether";
        }
    }

     

    ORIGINAL SOURCE: mew, MODIFIED BY: hydroflame

  5. <pro tip and trick>yagoki is right btw, some people expect us to just give an answer that they can copy paste, if you wanna learn a maximum its ok to copy paste, but make sure you understand what every statement does (a statement is from one ";" to another

     

    if you understand why/what/how its working, then you're good to go because if theres a problem you probably understand why/where its bugging and usually you can fix it without asking here. if you look a bit on the forum you realise that theres not a lot of very complex question, thats because "pros/expert" can deal with ANY problem by themselves (im not saying if you post here you're a noob, I'm just saying usually when you're good you can fix almost everything yourself)</pro tip and trick>

  6. duuuuuuude :P

     

    NBTCompound.setTagCompound and ItemStack.setTagCompound are 2 different things!!!!! they have the same name but they dont do the same thing AT ALL :P

     

    "safe" is NOT an itemStack if you want to see the declaration of safe.setTagCompound check the class

     

    net.mine.craft.nbt.NBTTAgCompound method setTagCompound

     

    ItemStack modul = new ItemStack(par1, 1,0);//clearly modul is a ItemStack
    NBTTagCompound safe = new NBTTagCompound();//clearly safe is NOT an itemstack
    safe.setCompoundTag("Modul", new NBTTagCompound());
    safe.setTagCompound(modul);//so we can deduce that calling this!!!! will not call the method you printed 
    

  7. ok well im telling you, im not doing it this way, there might be other way of doing it, but by looking at the nbt code i dont even know why this line is compiling

    safe.setTagCompound(modul);

     

    im 99% sure you are suppose to deal with the itemstack.stacknbtcompound because this variable is attached to the itemstack and the server will automaticly sync them between the server and the client.

     

  8. hijacking this thread

    i loled

     

    wouldn't there be two threads running if you create a new thread (the main mc thread and the new one you created)?

    you are absolutelly right there will be 2 thread running BUT the thin is the server thread cannot continue its work until the generation is finished. saying that it can continue it works (like continue to generate the caves n everything) would mean that from anywhere in the code you can receive the "is finished" message from the generating threads.

     

    technicly... it could be possible that the generating threads (GT) would NOT in ANY way communicate with the main thread other then by the method that creates then

     

    this "technique" would imply that the threads have "queue" of structure to generate and whenever the world gen wants to generate a structure he simply queues it to the least filled queue

     

    the code would ressemble this

     

    public class TowerGen implements IWorldGen{

    private TowerGenThread[] threads;

    public TowerGen(){

    threads = new TowerGenThread[5];

    }

     

    public void generateTower(){

     

    //code to decide where/if to put a tower

    //find tower with least ammount of queued tower

    //add tower to that thread

     

    //more code if you want

     

    }

     

     

    }

     

    public class TowerGenThread extends Thread{

    private Queue towerToGen = new IDontKnowTheExactClassName();

     

    public int getQueueSize(){

    return towerToGen.size();

    }

     

     

    public void addToQueue(/*args that describe the location*/){

    towerToGen.add(the args, either an object or wtv);

    }

     

    public void run(){

    while(true){

    if(towerToGen.hasNext()){//or wtv the name to check if theres an object in the queue

    //code to generate the tower

    }

    }

    }

     

    bascily this would also work, BUT you might find yourself in situation where a particular chunk isnt loaded because it took so much time that the player leaved the general area where the tower was supposed to be generated

     

     

     

    both design have advantage and disadvantage

     

    the first one keep the main idea of "single thread" because the server doesnt continue until its done but will be useless if the structures are very small

     

    if the structure are numerous but small in size the 2nd design MAY be a better solution.

     

  9. are you seriously defending the fact that your method work and at the same time saying it doesnt ??

    listen if youre 100% sure it works this way why are you on the forums right now?? because it doesnt work thats right

     

    about the car/box/car thigny ... no its not the same thing, because if you add the itemstack to the safe it does NOTHING and youve proved this yourself

     

    but since youre sooooo sure it works this way ill let you continue to make something tht doesnt make any sens work

  10. i think you got it backward

     

    try adding the nbt in the method "onCreate" instead //this may or may not be the solution depending on what you're trying to do

     

    also i heu ... i think your nbt creation is .. fucked up ?

    afaik you should be adding stuff to the nbtcompound of the item stack, not adding a itemstack to a nbtcompound

     

    ItemStack modul = new ItemStack(par1, 1,0);
    NBTTagCompound safe = new NBTTagCompound();
    safe.setCompoundTag("Modul", new NBTTagCompound());
    safe.setTagCompound(modul);

    these lines looks very weird to me

     

    i think its suppose to be like this instead

    ItemStack modul = new ItemStack(par1, 1,0);
    modul. stackTagCompound = new NBTTagCompound();
    modul. stackTagCompound.setInteger("name", value);
    //etc
    

     

    because in your case the "safe" nbtcompound isnt reued anywhere after, its jsut lost

  11. so heres how to read this code

     

     

    when youll start generating the structure, the server thread creates X "sub threads" each of those will be responsible to generate 1/X of the structure. (pick any axis and keep it as the "seperatable axis" exemple if you have a 10x20x30 structure, and you chose the x axis, the threads will generate from 1x20x30 to 5x20x30 and 6x20x30 to 10x20x30 (this is for 2 threads,  x threads= x subdivision) now the first loop creates all the threads and tell them which part they are responsible for

     

    the 2nd loops starts all the thread, after the 2nd loop is done executing all the threads will be generating the structure

     

    since they're all running in parallel the event log from this could look like this:

    situation 2 thread generating a 2x2x2

     

    thread1: generated 1, 1, 1

    thread2: generated 2, 1, 1

    thread1: generated 1, 1, 2

    thread2: generated 2, 1, 2

    thread1: generated 1, 2, 1

    thread2: generated 2, 2, 1

    thread1: generated 1, 2, 2

    thread2: generated 2, 2, 2

     

    optionnal note: since they are running in parallel this could be happening in ANY order (for some reason is it possible that the 2nd thread will generate more slowly but GENERALLY i should be pretty "symmetrical" )

     

    so after the 2nd loop they're all generating and thats great, but how do we know its done? this is what the third loop is for

     

    you see, at the end of the "run" method theres a isDone = true

    meaning when the thread is done generating its own part of the structure itll set the boolean to true and the function isDone will now return true

     

    the 3r loop basicly goes through each thread and wait til they are done generating

    since this is happening in parrallel this SHOULD happen all at the same time

    so the 3rd loop might wait 50 iteration of the while for the 1st loop to be done, but when itll be done all the other threads should ALSO be done, meaning it might not even enter then once !

     

    was that better ?

  12. nope all good i got a computer ill be albe to make complete answers

     

    ok so basicly your code to generate the world will look like this

     

    public void idontknowthename(arguments){
    //code
    StructureGeneratorThread[] threads = new StructureGeneratorThread[5];
    for(int i = 0; i < threads.length; i++){
    threads[i] = new StructureGeneratorThread(/*argument to give to have all information */ world, structureToGenerate, startIndex, endIndex);
    }
    
    for(StructureGeneratorThread thread : threads){//do you know about this way of writing for loops ? if not its just going to iterate through the list
    thread.start();
    }
    
    for(StructureGeneratorThread thread : threads){
    while(!thread.isDone()){}
    }
    //more code
    }
    

     

    public class StructureGeneratorThread extends Thread{
    boolean isDone = false;
    public StructureGeneratorThread(/*the args showed earlier*/){
    blah blah save all the args
    }
    
    public void run(){//this method will be automaticly called when start() is called
    //here you generate the structure from startIndex to endIndex, aka thread 1 from 0-9, 2 from 10-19 etc if its 5 thread for a 50 block wide structure
    
    isDone = true;
    }
    
    public boolean isDone(){ return isDone;}
    }
    

     

  13. round 2 (this "keyboard is painfull)

     

    ok so in the case that you are using only 1 thread, basicly this would happen.

    the minecraft thread creates a new thread, calls this thread and wait til its done... basicly while the main thread is waiting you got only 1 thread running, you didnt solve anything because overall, theres 1 thread doing nothing, 1 working. its the same as just having 1 thread doing all the work

     

    in the case of creating 2 thread, you have the main thread waiting but 2 thread creating the structure

    this is when you start gaining power

    if you've actually read about wait and notify and dont understand them heres another solution

     

    have the main thread create and start all thread and then have the main thread do something like this

    for(all my thread){

    while(!thread.isDoneGenerating()){}

    }

     

    make sure the custom thread set a boolean value to true tgat will be returned by isDoneGenerating when they are done generating their part

     

    basicly if it takes 5 sec (its just an overkill example) to generate the structure, they should all finish at the same time. so the mc server thread will do the first "while" a lot but then the next while might not even make it in once

     

    if thats still not clear tell me

    and sorry for the shitty typing/typos/explanation, coding on a phone is horrible

  14. hey there, i do have some thread knowledge and i think i might be able to help you. since youre asking the qestion youre obviously not a noob soooo i wont go into deep details.

    but basicly youre gonna want your world generator to create more then 1 thread, because if you only create 1 youre not solving the problem at all (feel free to ask why you need more then 1)

    basicly each thread will have to do 1/number of thread  of your structure

    aka, if your structure is 50 block long (doesnt matter how much width and height) and you have 5 thread, thread 1 will do from 0-9, T2 from 10-19 etc

     

    so make some class extends Runnable or even thread, make the constructor of this thread have a reference to the world, the starting location of the structure, the structure youre trying to do and which part of it the thread is suppose to construct.

    also include a reference to the thread that started the threads (aka the world generator )

     

    once thats all setup, in the world generator starts/run all thread and wait for them to complete. 

     

    it is important to note that minecraft is single threaded and it is a huge problem. so i suggest that even before starting to work on this. make a program an try to understand how thread works and specificly what are the functions Object.wait and Object.notify are doing (btw you know that every class that doesnt extends something specificly by default extends Object right ? so every object has the methods wait and notify)

     

    sry if my explanation is shitty but ive written all this on a phone

    fell free to pm me

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.