Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

[API] Minecraft Forge


  • This topic is locked This topic is locked
5021 replies to this topic

#1

LexManos
    LexManos

    Zombie Killer

  • Members
  • 233 posts

Posted 30 July 2011 - 10:18 PM

*
POPULAR

Important! DO NOT REPLY TO THIS THREAD!
We have our own forum, http://minecraftforge.net
Spoiler:

Posted Image

Register or log in to remove.

#2

Eloraam
    Eloraam

    Ghast Hunter

  • Members
  • 2773 posts
  • Minecraft: Eloraam

Posted 30 July 2011 - 11:31 PM

*
POPULAR

Important message to modders!

If you are:
1) Currently writing/maintaining a mod that is incompatible with MinecraftForge, or
2) Currently writing/maintaining a mod that is not base-clean

Then this message is for you!  If you need some help porting your mod to MinecraftForge, or if you need a couple extra hooks to make your mod work without base mods, feel free to drop me an email.

My target audience here is people who actually write mods, not users of incompatible mods.  I will not fix bugs in mods that you are not the current maintainer of (unless I wrote those mods, of course, I fix my own bugs).

I'm one of the maintainers of MinecraftForge, so I can add new hooks to it, if required.
Posted Image

#3

superbunnybun

Posted 31 July 2011 - 12:09 AM

what does the dk.class file do?  it conflicts with the Dynamic Lights mod

#4

Eloraam
    Eloraam

    Ghast Hunter

  • Members
  • 2773 posts
  • Minecraft: Eloraam

Posted 31 July 2011 - 01:11 AM

View Postsuperbunnybun, on 31 July 2011 - 12:09 AM, said:

what does the dk.class file do?  it conflicts with the Dynamic Lights mod

That's WorldRenderer, there are two hooks in that, one used by Buildcraft, the other by RedPower.
Posted Image

#5

BrickedKeyboard

Posted 31 July 2011 - 01:53 AM

Right off : does modloader still function?  Modloader has a method where you can specify a new ore to be spawned in the game world, and specify the probabilities, etc.  Does this method still work?  Spacetoad implied that Minecraft forge breaks it (which means that Industrial Craft won't work, nor will plasma craft or any of 50+ other mods)

#6

Eloraam
    Eloraam

    Ghast Hunter

  • Members
  • 2773 posts
  • Minecraft: Eloraam

Posted 31 July 2011 - 02:07 AM

View PostBrickedKeyboard, on 31 July 2011 - 01:53 AM, said:

Right off : does modloader still function?  Modloader has a method where you can specify a new ore to be spawned in the game world, and specify the probabilities, etc.  Does this method still work?  Spacetoad implied that Minecraft forge breaks it (which means that Industrial Craft won't work, nor will plasma craft or any of 50+ other mods)

You know, I thought it did, but looking through the ModLoader documentation, I don't see any reference to that method.  I see ones for entities, but not for blocks.

To answer your question, I'm not really sure. I didn't write that hook, and I didn't investigate it since my mod doesn't generate ores.

A couple of the hooks in MinecraftForge are designed for IndustrialCraft, since SpaceToad is trying to get Alblaka onboard.

Anyway, it's designed to be used with ModLoader and ModLoaderMp, since both the current maintainers write mods using both.
Posted Image

#7

bfree380

Posted 31 July 2011 - 02:08 AM

Holy crap!  Infinite terrain and sprite indexes!  That is absolutely awesome!  Now I can have even more mods on my server!  Thanks a ton.  Will be downloading later tonight.

#8

BrickedKeyboard

Posted 31 July 2011 - 02:57 AM

View PostEloraam, on 31 July 2011 - 02:07 AM, said:

You know, I thought it did, but looking through the ModLoader documentation, I don't see any reference to that method.  I see ones for entities, but not for blocks.

To answer your question, I'm not really sure. I didn't write that hook, and I didn't investigate it since my mod doesn't generate ores.

A couple of the hooks in MinecraftForge are designed for IndustrialCraft, since SpaceToad is trying to get Alblaka onboard.

Anyway, it's designed to be used with ModLoader and ModLoaderMp, since both the current maintainers write mods using both.


Ok I was wrong.  Apparently here's how it works.  Now, I THOUGHT that this method used modloader because another mod creator who wrote an ore redistribution mod specifically mentioned that this method no longer works with his mod.  Here's how IC does it :

Spoiler:


#9

BrickedKeyboard

Posted 31 July 2011 - 03:14 AM

Which is line by line copy and pasted from here :

public void GenerateSurface(World world, Random rand, int chunkX, int chunkZ)
    {
        for(int i = 0; i < (RARITY); i++)
        {
            int randPosX = chunkX + rand.nextInt(16);
            int randPosY = rand.nextInt(DEPTH);
            int randPosZ = chunkZ + rand.nextInt(16);
            (new WorldGenMinable(mod_Emeralds.emeraldOre.blockID, 5)).generate(world, rand, randPosX, randPosY, randPosZ);
        }
    }

That's a tutorial written by someone else.

I still haven't figured out how this code gets called when there must be other instances of GenerateSurface elsewhere in the minecraft code.  I'm a C programmer - in java if there are multiple functions with the same name, do they auto-merge together or something?  That would make a lot of sense.  (because the code above would work just fine if above and below it were other identical segments of code like that for generating the other ores in the minecraft world)

#10

Eloraam
    Eloraam

    Ghast Hunter

  • Members
  • 2773 posts
  • Minecraft: Eloraam

Posted 31 July 2011 - 03:37 AM

View PostBrickedKeyboard, on 31 July 2011 - 03:14 AM, said:

That's a tutorial written by someone else.

I still haven't figured out how this code gets called when there must be other instances of GenerateSurface elsewhere in the minecraft code.  I'm a C programmer - in java if there are multiple functions with the same name, do they auto-merge together or something?  That would make a lot of sense.  (because the code above would work just fine if above and below it were other identical segments of code like that for generating the other ores in the minecraft world)

No, nothing like that.  Actually, there are simply no such thing as global functions in Java at all.  You have to take into consideration the class that they belong to.

See in this case, it's really simple.  The class is derived from BaseMod, and ModLoader calls GenerateSurface or GenerateNether during the block generation stuff.  Which... actually I'm a little puzzled that we added a new hook to also do ore generation.  Well, I'll be messing around with ore generation myself pretty soon (sekrit mod is sekrit), so I'll get a chance to give that a good looking at and find out the answer.
Posted Image

#11

BrickedKeyboard

Posted 31 July 2011 - 03:53 AM

View PostEloraam, on 31 July 2011 - 03:37 AM, said:

See in this case, it's really simple.  The class is derived from BaseMod, and ModLoader calls GenerateSurface or GenerateNether during the block generation stuff.  
Back to my original question : did you destroy these modloader hooks when you made MineForge?  If you didn't, then about 50 different mods will keep on working. (if you browse these forums a lot, you'll notice that the most common mod by far is one that just adds new types of ore and corresponding tools/armor to be made from it)

Granted, all those mods suck, but if you want MineForge to be widely adapted (or better still, get custody of modloader from Risugami so that you can just release a single unified mod) they need to continue working.

#12

Jay
    Jay

    Diamond Miner

  • Members
  • 866 posts
  • Minecraft: Jay

Posted 31 July 2011 - 04:16 AM

Posting because I think you two are the best to develop this thing, and that I hope to god the rest of the modding community wises up to the fact that not everybody can go off and develop their own things to perform these common functions >.<
(If my posts seem hostile, read my "About me" page!)

#13

Jaster
    Jaster

    Diamond Miner

  • Members
  • 725 posts
  • Minecraft: JasterMK5

Posted 31 July 2011 - 04:25 AM

Very nice,but sadly this conflicts with Shockas apps so i cant use this with the aether so no new buildcraft for me :(

#14

Eloraam
    Eloraam

    Ghast Hunter

  • Members
  • 2773 posts
  • Minecraft: Eloraam

Posted 31 July 2011 - 04:41 AM

View PostBrickedKeyboard, on 31 July 2011 - 03:53 AM, said:

Back to my original question : did you destroy these modloader hooks when you made MineForge?  If you didn't, then about 50 different mods will keep on working. (if you browse these forums a lot, you'll notice that the most common mod by far is one that just adds new types of ore and corresponding tools/armor to be made from it)

Granted, all those mods suck, but if you want MineForge to be widely adapted (or better still, get custody of modloader from Risugami so that you can just release a single unified mod) they need to continue working.

I'm pretty sure we left them alone.  I seem to recall that, from the brief look I took, SpaceToad's hook fires in a different place, which is supposed to be easier to add ores from.  Or something.  I don't really know, I'm talking about a subsystem that I haven't studied at all.

I'd personally love to take over ModLoader and ModLoaderMp, and merge them both with this to make a single unified mod.  There's a few people that would have to give the green light for that, though, and I don't expect to see it happen any time soon.  Besides that, since I use MCP, I wouldn't be able to update ModLoader as quickly as Risu does, so I'm not sure the tradeoff works for everyone.
Posted Image

#15

BrickedKeyboard

Posted 31 July 2011 - 05:23 AM

View PostEloraam, on 31 July 2011 - 04:41 AM, said:

Besides that, since I use MCP, I wouldn't be able to update ModLoader as quickly as Risu does, so I'm not sure the tradeoff works for everyone.

That one shouldn't be an issue in 1.8, right?  There will need to be one more release of MCP to translate the class/method/variable/etc names from the MCP versions to the REAL names that Notch uses.  But after that release, MCP will be defunct.

#16

BrickedKeyboard

Posted 31 July 2011 - 05:31 AM

View PostEloraam, on 31 July 2011 - 04:41 AM, said:

I'd personally love to take over ModLoader and ModLoaderMp, and merge them both with this to make a single unified mod.  

Why not ALSO take over MCE while you're at it? MCE is SIMPLE...there's really not much to the code.  100 lines, tops, and it only touches a few core classes.  That way when we run Forge it's just one install and we get unlimited blocks, sprites, AND terrain pngs.

That's a solid case for incorporation.

Just need two people to sign off : Risugami and Flan.  And they'll still have commit rights on Sourceforge, so it's not like they lose the ability to add stuff to these mods.

#17

BrickedKeyboard

Posted 31 July 2011 - 05:40 AM

Here's the killer app.  This is THE WAY to make Minecraft forge used by EVERYONE.  

It absolutely must have this feature.  Full stop, no way around it.  And if it does, everyone will use it.

AUTO-MOD DOWNLOAD!  If a player connects to a multiplayer server running mods, it must be able to automatically download from the server
       1.  RESOURCE FILES
       2.  THE MOD's class files
       3.  The mod's configuration files

And to create a separate instance of minecraft.jar with all the above installed, with a link available in a menu under 'multiplayer'

This way, the average player would need to do the following :

1.  Install Mineforge (using a binary patcher installer than finds %appdata%/.minecraft automatically)

2.  Play on any server configured to support all this, with any mods imaginable that work together in a grouping on that server.

This is why the overwhelming majority of SMP servers (more than 90%) do not have client-side mods running.  It is far too much to expect the average minecraft player to even have winrar installed, much less be able to install a mod according to a complex procedure involving multiple files.  At least 75% of the bug reports in the threads for a typical mod are due to mis-installation.

Implementation : if we had an open source FTP client/server library rolled into mineforge this might not be too difficult.  Handling all the special cases so that virtually any SMP mod works could be tough.

#18

Jay
    Jay

    Diamond Miner

  • Members
  • 866 posts
  • Minecraft: Jay

Posted 31 July 2011 - 05:44 AM

View PostBrickedKeyboard, on 31 July 2011 - 05:40 AM, said:

Here's the killer app.  This is THE WAY to make Minecraft forge used by EVERYONE.  

That sounds exactly like what the BukkitContrib (=> Spout) project is eventually aiming for.  I'm really unsure of how long it'll take to get to that point, though.

It's also aiming to hook -everything- on the client side, like Bukkit on the server, so clientside mods can be made as easily as Bukkit plugins.
But that's a LONG way off.
(If my posts seem hostile, read my "About me" page!)

#19

BrickedKeyboard

Posted 31 July 2011 - 05:51 AM

View PostJay, on 31 July 2011 - 05:44 AM, said:

That sounds exactly like what the BukkitContrib (=> Spout) project is eventually aiming for.  I'm really unsure of how long it'll take to get to that point, though.

It's also aiming to hook -everything- on the client side, like Bukkit on the server, so clientside mods can be made as easily as Bukkit plugins.
But that's a LONG way off.

Right.  And why wait for the slowpokes to finally make something?  Eloraam has added more features to minecraft in the last month than Notch has added in 6 months.  This is because she's either more talented or just has more energy.

The libraries to use are Apache and one of the many free FTP client libraries.
http://mina.apache.o...-5-minutes.html

So transferring the data is straightforward.  The real question is which files do we send.  How do we make the menu system work.  Is relaunching minecraft the best way to roll?  Do we use a binary patch library?  Or do we just send whole .jar files?  (since the user must be connected to the MineForge FTP server via a legit copy of minecraft ANYWAYs the copyright question is moot)

The idea I have is this.  When the user clicks the "multiplayer" button a new menu is drawn.  There would be a list of the names of preconfigured client packages that the user has downloaded for connecting to his/her favorite minecraft servers.  If the user selects one of the entries in the list, minecraft is relaunched and the different mod set is initialized.  (i wish this could be done without a relaunch but I understand that modloader and minecraft itself aren't written to work this way).  

If the user connects to a server that he does not have the correct client package for (client packages would be zip files with MD5 checksums and the checksum for the package in use is sent to the server), Mineforge gives a menu option to download the client package for a server.  Upon approval, mineforge launches an embedded FTP library and downloads the client packages, extracts it, possibly runs a binary patcher (uggh..hard to find one on google that you can embed in java...), and then adds a new menu option to the list.

Client packages would be a specially modified version of minecraft that has the single player menu option removed and will only connect to a specific minecraft server.

#20

Eloraam
    Eloraam

    Ghast Hunter

  • Members
  • 2773 posts
  • Minecraft: Eloraam

Posted 31 July 2011 - 05:54 AM

View PostBrickedKeyboard, on 31 July 2011 - 05:23 AM, said:

That one shouldn't be an issue in 1.8, right?  There will need to be one more release of MCP to translate the class/method/variable/etc names from the MCP versions to the REAL names that Notch uses.  But after that release, MCP will be defunct.

Wait, has Notch committed to removing obfuscation?  That would be great news, if true!
Posted Image