Results 1 to 3 of 3
  1. #1
    Battelfield is offline Member
    Join Date
    Dec 2011
    Posts
    2
    Rep Power
    0

    Default Game modification help

    Some of you may have allready heard of game called Minecraft. I'm one of many modders that make different mods for Minecraft and I'm trying to make an API for modders to use simple hooks and for extending the compatibilty with other modifications (due to class overwriting). I'm new to java but I have made some things allready.

    I'm trying to make biome API for it and I'm having problems adding biomes to some part of the code.
    Java Code:
    package net.minecraft.src;
    
    public class GenLayerVillageLandscape extends GenLayer
    {
    
        public static BiomeGenBase allowedBiomes[];
    
        public GenLayerVillageLandscape(long l, GenLayer genlayer)
        {
            super(l);
            allowedBiomes = (new BiomeGenBase[] {
                BiomeGenBase.desert, BiomeGenBase.forest, BiomeGenBase.hills, BiomeGenBase.swampland, BiomeGenBase.plains, BiomeGenBase.taiga, mod_BiomeTest.plains
            });
            parent = genlayer;
        }
    
        public int[] func_35500_a(int i, int j, int k, int l)
        {
            int ai[] = parent.func_35500_a(i, j, k, l);
            int ai1[] = IntCache.getIntCache(k * l);
            for(int i1 = 0; i1 < l; i1++)
            {
                for(int j1 = 0; j1 < k; j1++)
                {
                    func_35499_a(j1 + i, i1 + j);
                    int k1 = ai[j1 + i1 * k];
                    if(k1 == 0)
                    {
                        ai1[j1 + i1 * k] = 0;
                        continue;
                    }
                    if(k1 == BiomeGenBase.mushroomIsland.biomeID)
                    {
                        ai1[j1 + i1 * k] = k1;
                        continue;
                    }
                    if(k1 == 1)
                    {
                        ai1[j1 + i1 * k] = allowedBiomes[nextInt(allowedBiomes.length)].biomeID;
                    }
                    else
                    {
                        ai1[j1 + i1 * k] = BiomeGenBase.icePlains.biomeID;
                    }
                }
    
            }
    
            return ai1;
        }
    }
    I want to add a hook like

    BAPI.registerBiome(testbiome);

    and it would register that biome inside that allowedBiomes thing wich I am actually trying to define what it is and how to add things to it from some other class with simple hook and without editing it(I can edit it for the purpose of API but for the others that they wouldn't need to edit it). If it would be list that wouldn't be a problem, but what exactly is it and how to add things to it with a hook?

    I have allso made class called BAPI and added method registerBiome(BiomeGenBase bgb) but I don't really know what to put in it.

    Kind regards
    Battlefield

    You'll probably say that I shouldn't go into doing this if I'm not experienced enough, but I really want to do it.

  2. #2
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default Re: Game modification help

    There's nothing saying you shouldn't do it, however Minecraft is a huge application. Last time I remember someone asking for help creating something with Minecraft all we could offer was advice on where to look for more experienced advice in the matter.

    However, you did not really leave us with a question. What is your issue? What isn't working? Why isn't it working? Does it compile? Does it inject/import? You have to really give us some quality details here because I seriously doubt any of us are knowledgeable in editing Minecraft.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  3. #3
    Battelfield is offline Member
    Join Date
    Dec 2011
    Posts
    2
    Rep Power
    0

    Default Re: Game modification help

    There is no problem with recompiling I just need some help adding my biome to that allowedBiomes thing with simple hook and I want to make that hook because there isn't anything that would add hook like that. It would be good enough if you tell me what that allowedBiomes thing at the top of the code is. I'm guessing(new to java)) it's table or is it something else(I know it's not list). If I try adding list there it says cannot convert from List to BiomeGenBase(I understand that) in eclipse it says I should change from List to BiomeGenBase in method getBiomes but then I get bunch of other errors. Is there maybe a way that I could add things to allowedBiomes like you do with lists (you know list.add(somethingYouWantToAdd))?

    Here is BAPI source
    Java Code:
    package net.minecraft.src;
    
    import java.util.ArrayList;
    import java.util.List;
    
    public class BAPI {
    	private static List biomes = new ArrayList();
    	
    	public static void registerBiome(BiomeGenBase is){
    		biomes.add(is);
    	}
    	
    	public static List getBiomes(){
    		return biomes;
    	}
    	
    
    }

Similar Threads

  1. concurrent modification
    By mharsijamel in forum New To Java
    Replies: 1
    Last Post: 11-06-2011, 02:59 PM
  2. JTable entry modification
    By lemontree45 in forum New To Java
    Replies: 1
    Last Post: 09-19-2011, 05:17 PM
  3. Modification in XML file
    By anurag_1226 in forum Java Software
    Replies: 1
    Last Post: 04-10-2010, 06:53 PM
  4. help with concurrent modification exception
    By jdgallag in forum New To Java
    Replies: 1
    Last Post: 11-30-2008, 09:19 PM
  5. Inventory Program modification help
    By badness in forum Java Applets
    Replies: 1
    Last Post: 01-17-2008, 05:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •