Minecraft Blogs / Tutorial

Lets Make A Mod! Ep.2 Proxies 1.4.X

  • 355 views, 2 today
  • 2
  • 0
lilpsyco99's Avatar lilpsyco99
Level 43 : Master Modder
52
Ok so i will continue to update as i get my videos on youtube about the mod making above 2 likes! :) anyway thanks for viewing this on to the directions. Please give me a thanks for this hard work! Click the diamond up there in the left hand corner it only takes like 5 seconds it makes me happy and incourages me to do more if you have a error or question as always put it in the comments and ill answer
This time it will not be in spoilers because i dont think many of you liked that :/

  • First open eclipse and go to your project/mod if you dont know how to do that its because i explained it in the last blog/video please go back here and read it or watch the video :) while your there drop a diamond it only takes 5 seconds and it makes me happy :)

-------------------------------------------------------------------------------------------------------

  • Now that we are in eclipse expand your src and common folders. Now that you have that go up to the src folder (Everything client-only will go here: Client Proxies, Model files, Render files, Gui files, etc), right click select new then package name it like so: yourusername.yourmodname.client for example mine would be psycosishc.tutorialmod.client. For the time we arent going to use that but we will come back to it in a minute.

-------------------------------------------------------------------------------------------------------


  • Now come back down to your common package the one we made in the last post. Create a new class call it ModnameCommonProxy so for example mine would be TutorialmodCommonProxy. For now we will not change the coding inside of this class.

-------------------------------------------------------------------------------------------------------


  • Now go back up to the package you made in the src folder. Now that your there create a new class call it ModnameClientProxy for example mine will be called TutorialmodClientProxy the only change you need to make to this is to add extends ModNameCommonProxy at the public class line so it should now look something like this:
package psycosishc.tutorialmod.client; public class TutorialmodClientProxy extends TutorialmodCommonProxy { }
Now you should get an error hover over the red line and a box should
pop up select import ModnameCommonProxy

-------------------------------------------------------------------------------------------------------
  • Now these classes do nothing unless "hooked" to your base mod file so lets fix that shall we? In your base mod file wright the following to lines under your instance variable:

@SidedProxy(clientSide="yourusername.yourmodname.client.ClientProxyClass", serverSide="yourusername.yourmodname.common.CommonProxyClass") public static CommonProxyClass proxy;
so for example mine would look like this:

package psycosishc.tutorialmod.common;


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.SidedProxy;

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.network.NetworkMod;


@Mod(modid = "tutorial", name = "Tutorial Mod", version = "1.0.0")

@NetworkMod(clientSideRequired = true, serverSideRequired = false)


public class TutorialMain {

@Instance("tutorial")

public static TutorialMain instance;

@SidedProxy(clientSide="psycosishc.tutorialmod.client.TutorialmodClientProxy", serverSide="psycosishc.tutorialmod.common.TutorialmodCommonProxy")

public static TutorialmodCommonProxy proxy;

@PreInit

public void preInit(FMLPreInitializationEvent event) {

}


@Init

public void init(FMLInitializationEvent event) {

}


@PostInit

public static void postInit(FMLPostInitializationEvent event) {

}

}

Common Proxy (TutorialmodCommonProxy.java)

package psycosishc.tutorialmod.common;


public class TutorialmodCommonProxy {


}

Client Proxy (TutorialClientProxy.java)

package psycosishc.tutorialmod.client;


import psycosishc.tutorialmod.common.TutorialmodCommonProxy;


public class TutorialmodClientProxy extends TutorialmodCommonProxy {


}





@SidedProxy is an annotation that registers a proxy.clientSide is the pointer to the client proxy. It should be package name, followed by a dot, followed by the name of the file/class.serverSide is the pointer to the server proxy. Format is the same.bukkitSide is the pointer to the Bukkit proxy. I don't know how to use Bukkit, so I'm not explaining this.

You should get an error at @SidedProxy. Just do what you did for the client proxy. (hover over the red line and chose Import ****

Now press the green play button and watch the magic :P

This will be our final codes

-------------------------------------------------------------------------------------------------------

Final Code

Main mod class (TutorialMain.java)

package psycosishc.tutorialmod.common;


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.SidedProxy;

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.network.NetworkMod;


@Mod(modid = "tutorial", name = "Tutorial Mod", version = "1.0.0")

@NetworkMod(clientSideRequired = true, serverSideRequired = false)


public class TutorialMain {

@Instance("tutorial")

public static TutorialMain instance;

@SidedProxy(clientSide="psycosishc.tutorialmod.client.TutorialmodClientProxy", serverSide="psycosishc.tutorialmod.common.TutorialmodCommonProxy")

public static TutorialmodCommonProxy proxy;

@PreInit

public void preInit(FMLPreInitializationEvent event) {

}


@Init

public void init(FMLInitializationEvent event) {

}


@PostInit

public static void postInit(FMLPostInitializationEvent event) {

}

}

Common Proxy (TutorialmodCommonProxy.java)

package psycosishc.tutorialmod.common;


public class TutorialmodCommonProxy {


}

Client Proxy (TutorialClientProxy.java)

package psycosishc.tutorialmod.client;


import psycosishc.tutorialmod.common.TutorialmodCommonProxy;


public class TutorialmodClientProxy extends TutorialmodCommonProxy {


}


-------------------------------------------------------------------------------------------------------

Common Proxy (TutorialmodCommonProxy.java)
-------------------------------------------------------------------------------------------------------
package psycosishc.tutorialmod.common;

public class TutorialmodCommonProxy {

}
-------------------------------------------------------------------------------------------------------
Client Proxy (TutorialmodClientProxy.java)
------------------------------------------------------------------------------------
package telinc.tutorialmod.client;

import psycosishc.tutorialmod.common.TutorialCommonProxy;

public class TutorialmodClientProxy extends TutorialmodCommonProxy {

}


-------------------------------------------------------------------------------------------------------

And theres our proxy tutorial :) next tutorial whenever i finish the next video hopefully tommorow:)
Tags

1 Update Logs

Update #1 : by lilpsyco99 11/28/2012 10:39:43 pmNov 28th, 2012

Made the post neater fixed some grammatical issues and added the video :)

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome