[Minecraft 1.8.1] SDK’s ModLoaderMp

Guide:

Step 1 : Install with MCP

USE A NEW MCP FOLDER : You dont want to wipe your mod source now do you?

Open the new MCP folder
Go to jars and add a clean minecraft_server.jar
Open this minecraft_server.jar and add ModLoaderMp server
In the jars folder add the resources and bin folders of a clean minecraft install.
Open jars/bin/minecraft.jar and add the latest ModLoader and ModLoaderMp Client

If you get an exception2; error look at the following spoiler on how to fix it. If not, skip the spoiler.

Spoiler
Go to sources/minecraft_server/net/minecraft/server
Open MinecraftServer.java
Delete lines 260 ~ 376
Add this in their place
    public void run()
    {
        try
        {
            if(startServer())
            {
                long l = System.currentTimeMillis();
                long l1 = 0L;
                while(serverRunning)
                {
                    ModLoader.OnTick(this);
                    long l2 = System.currentTimeMillis();
                    long l3 = l2 - l;
                    if(l3 > 2000L)
                    {
                        logger.warning("Can't keep up! Did the system time change, or is the server overloaded?");
                        l3 = 2000L;
                    }
                    if(l3 < 0L)
                    {
                        logger.warning("Time ran backwards! Did the system time change?");
                        l3 = 0L;
                    }
                    l1 += l3;
                    l = l2;
                    if(worldMngr[0].isAllPlayersFullyAsleep())
                    {
                        doTick();
                        l1 = 0L;
                    } else
                    {
                        while(l1 > 50L)
                        {
                            l1 -= 50L;
                            doTick();
                        }
                    }
                    Thread.sleep(1L);
                }
            } else
            {
                while(serverRunning)
                {
                    commandLineParser();
                    try
                    {
                        Thread.sleep(10L);
                    }
                    catch(InterruptedException interruptedexception)
                    {
                        interruptedexception.printStackTrace();
                    }
                }
            }
        }
        catch(Throwable throwable1)
        {
            throwable1.printStackTrace();
            logger.log(Level.SEVERE, "Unexpected exception", throwable1);
            while(serverRunning)
            {
                commandLineParser();
                try
                {
                    Thread.sleep(10L);
                }
                catch(InterruptedException interruptedexception1)
                {
                    interruptedexception1.printStackTrace();
                }
            }
        }
        finally
        {
            try
            {
                stopServer();
                serverStopped = true;
            }
            catch(Throwable throwable2)
            {
                throwable2.printStackTrace();
            }
            finally
            {
                                try
                                {
                                        stopServer();
                                        serverStopped = true;
                                }
                                catch(Throwable throwable2)
                                {
                                        throwable2.printStackTrace();
                                }
                                finally
                                {
                                        System.exit(0);
                                }
                        }
        }
    }

Recompile to check everything compiles nicely. If not, please contact me for help.
Note : The client will not be able to connect to the server unless there is a multiplayer mod installed. So just check it compiles at the moment.

Step 2 : Add mod source to new MCP

Go to your old singleplayer MCP folder and navigate to your source (MCP\src\minecraft\net\minecraft\src)
Copy your source and any edited notch classes over to the same folder in the new MCP
Open any mod_ files and change the class to extend BaseModMp rather than BaseMod
Copy the source from this folder to MCP\src\minecraft_server\net\minecraft\src in the new MCP
(DO NOT copy notch classes over. You have to open the corresponding classes in the server folder and edit them yourself)
Note that Model, Render and Gui classes are not required server side

At this point, some mods may be ready to compile, others may need some modifying. If your mod adds entities or guis, you will need to change some things. If your mod is simple and contains only blocks, items and recipes, continue to step 5

Step 3 : Fix Entities

This is in two parts (mobs and other entities; skip to the appropriate part)

Part 1 : Mobs

Mobs in SMP are very simple. Take the following line :

ModLoader.RegisterEntityID(EntityClass.class, "EntityName", ModLoader.getUniqueEntityID());

And turn it into

ModLoader.RegisterEntityID(EntityClass.class, "EntityName", ID));

Where ID is a number (under 128) you choose to represent your mob. You can find available IDs in this spreadsheet (column B : “Entity IDs”)
https://spreadsheets…bUE&hl=en#gid=0

Make the change on both client and server (with the same ID) and your mob should work.

Note that the server side mob must implement IAnimal if it doesn’t extend EntityMob or EntityAnimal.

Part 2 : Other Entities

Most entities are created by a vehiclespawn packet and controlled by various movement and position packets.
If your entity class contains worldObj.multiplayerWorld at any point, you need to change it to worldObj.singleplayerWorld
There may be other errors with your entities depending on how complicated they are and on differing client/server names but you will have to fix these yourself or ask a modder for help

To register your entity with ModLoaderMp’s entity tracker you need to add some lines client and server side
Firstly, you need to choose a netID, which is basically an identifier for your entity (a bit like a block ID). Go to this spreadsheet and choose a free ID in the “VehicleSpawn IDs” column. Don’t forget to fill in the box with your Entity to avoid conflicts.
https://spreadsheets…bUE&hl=en#gid=0

In the client side mod_ constructor

ModLoaderMp.RegisterNetClientHandlerEntity(Entity____.class, netID);

Where Entity_____.class is the class of the entity being tracked and netID is the entity’s netID

And in the server side mod_ constructor

ModLoaderMp.RegisterEntityTrackerEntry(Entity_____.class, netID);
ModLoaderMp.RegisterEntityTracker(Entity______.class, 160, 5);

Entity____.class and netID are the same as before. 160 is some arbitrary number and I can’t remember what its for. 5 is how often to update (so this mod updates once every 5 ticks, or 4 times a second).

That should be enough to get your entities working with ModLoaderMp.

Step 4 : Fix Guis

To make an SMP gui you are going to need to change the Gui calling code server side and add a method client side to handle the GUI. You will also need a GUI ID. Open this spreadsheet and choose a free ID in the “Net GUIs” column, making sure to fill it in with your GUI name.
https://spreadsheets…bUE&hl=en#gid=0

On the server (in the entity / tileEntity / block where the gui is created) you need to change the method call to this format

ModLoader.OpenGUI(player, guiID, inventory, container);

where player is the player who is opening the GUI,
guiID is the ID you chose
inventory is the inventory you are editing (the dispenser / minecart / plane for example)
container is the slot interface you are using (ContainerChest for example)

Client side we need to add a line in the mod_ constructor

ModLoaderMp.RegisterGUI(this, guiID);

and to the mod_ class, we must add a new method.

        public GuiScreen HandleGUI(int inventoryType)
        {
                if(inventoryType == guiID)
                        return new Gui_____(args);
                else return null;
        }

Where Gui_________ is the name of your GUI class and args are the arguments for the gui. ModLoader.getMinecraftInstance().thePlayer can be very useful here.

That should fix your GUI, but if not, please do ask me for help.

Step 5 : Recompile

One last thing before recompiling; go to the serverside mod_ file and delete any lines that use the method ModLoader.AddName(… and the entire AddRenderer(Map map) method if you have one
Run recompile.bat and see if you get any errors. If you can figure them out yourself and fix them, great, but if you can’t, please contact me.
Now run test_server.bat and test_game.bat, connect to 127.0.0.1 and see how it went.

When everything works to your satisfaction, re-obfuscate and distribute.

 

Installation : Client 1.8.1

Requires Risugami’s ModLoader
Simply drag and drop the files into minecraft.jar
Delete META-INF, even though you already did with ModLoader

Download Link:

http://www.mediafire.com/?vc438cuv253gqcw

Installation : Server 1.8.1

Drag and drop all files into minecraft_server.jar
(Don’t delete META-INF)

Download Link:

http://www.mediafire.com/?36uyrdq8x2bgm7q

Từ khóa gợi ý tìm kiếm:

Mod loader 1 8 1, modloadermp , hack vcoin au khong can the, minecraft 1 8 1, modloader 1 8 1, modloader MP, modloader mp 1 8 1


Kết quả khác cho: "[Minecraft 1.8.1] SDK’s ModLoaderMp"

Loading