Solved Generate a world without jungle

Discussion in 'Plugin Development' started by xize, Mar 11, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    xize

    Hello,

    I'm planning to write a generator without a jungle biome I came across on this link
    and whas wondering can you use this to actually set a biome within a generation?

    I'm pretty new with terrain generators, what kind of event should I use to get the cordinates before its allready generated?

    thanks.
     
  2. Offline

    chasechocolate

    Hmmm... I am interested in doing the same, except without oceans (for Hunger Games). If anyone knows how, that would be great!
     
  3. Offline

    Cybermaxke

    xize
    chasechocolate

    This should replace the jungle biomes by normal forests. Maybe the biome colors will be still there and plugins which use biomes still think that it are jungles.

    Code:
    public class NoMoreJungles extends JavaPlugin {
     
        @Override
        public void onEnable() {
            BiomeBase[] a = BiomeBase.biomes;
            BiomeForest nb1 = new BiomeForest(21);
            BiomeForest nb2 = new BiomeForest(22);
     
            try {
                Method m1 = BiomeBase.class.getMethod("b", int.class);
                m1.setAccessible(true);
     
                Method m2 = BiomeBase.class.getMethod("a", String.class);
                m2.setAccessible(true);
     
                Method m3 = BiomeBase.class.getMethod("a", int.class);
                m3.setAccessible(true);
     
                Method m4 = BiomeBase.class.getMethod("a", float.class, float.class);
                m4.setAccessible(true);
     
                m1.invoke(nb1, 353825);
                m2.invoke(nb1, "Jungle");
                m3.invoke(nb1, 5159473);
                m4.invoke(nb1, 0.7F, 0.8F);
     
                m1.invoke(nb2, 353825);
                m2.invoke(nb2, "JungleHills");
                m3.invoke(nb2, 5159473);
                m4.invoke(nb2, 0.7F, 0.8F);
     
                Field f1 = BiomeBase.class.getDeclaredField("JUNGLE");
                Field f2 = BiomeBase.class.getDeclaredField("JUNGLE_HILLS");
                this.setFinalStatic(f1, nb1);
                this.setFinalStatic(f2, nb2);
     
                a[21] = nb1;
                a[22] = nb2;
     
                Field f3 = BiomeBase.class.getDeclaredField("biomes");
                this.setFinalStatic(f3, a);
            } catch (Exception e) {}
        }
     
        @Override
        public void onDisable() {
           
        }
     
        public void setFinalStatic(Field field, Object obj) throws Exception {
            field.setAccessible(true);
     
            Field mf = Field.class.getDeclaredField("modifiers");
            mf.setAccessible(true);
            mf.setInt(field, field.getModifiers() & ~Modifier.FINAL);
     
            field.set(null, obj);
        }
    }
     
  4. Offline

    naorpeled

    this isnt working :
    chasechocolate maybe you could help me?
    Code:Java
    1.  
    2. [FONT=Consolas] BiomeBase[] a = BiomeBase.biomes;[/FONT]
    3. [FONT=Consolas] BiomeForest nb1 = new BiomeForest(21);[/FONT]
    4. [FONT=Consolas] BiomeForest nb2 = new BiomeForest(22);[/FONT]
    5. [FONT=Consolas][/FONT]
     
Thread Status:
Not open for further replies.

Share This Page