Minecraft Blogs / Tutorial

How to make a minecraft mod for 1.7.10 - Blog 3 - Setting up Proxies

  • 568 views, 1 today
  • 1
  • 0
Planetjoshua's Avatar Planetjoshua
Level 24 : Expert Architect
10
Welcome back everybody to MINECRAFT MODDING SERIES!
Today we are adding Proxies. A Proxy is if you are trying to affter you package your mod run on a server, or a client.

First, (Optional) in src/main/java add a new package name it: com.yourname.Proxy or com.yourname.core.Proxy In my case it would be: com.joshua.Proxy or it could be com.joshua.core.Proxy

Second, In MainRegistry class. Add in the class @Instance((optional)value = RefStrings.MODID)
public static MainRegistry instance; or modInstance;

Third. Import Instance to cmd.tools.
Fourth. Type under the Instance @SidedProxy(clientSide = , serverSide = , (optional) modId = RefStrings.MODID)

Fith. In your RefStrings class add Two new strings. so do something like this:
public static final String CLIENTSIDE = "com.yourname.Proxy.ClientProxy", "com.yourname.core.Proxy.ClientProxy";
public static final String SERVERSIDE = "com.yourname.Proxy.ServerProxy", "com.yourname.core.Proxy.ServerProxy";




Sixth. Back in MainRegistry class under the @SidedProxy make the clientSide go to the RefStrings.CLIENTSIDE Same with the Serverside to RefStrings.SERVERSIDE

Seventh. Under the @SidedProxy Function. Type: public static ClientProxy proxy;




-------------------------------------
Now why do we have the ClientProxy Instead of the ServerProxy?

The reason why is beacause if you want your mod to be on a server and client working. then it must access to it. Otherwise your mod wont get in with your server and it will crash.

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

Eighth. in your main package or your Proxy Class make Two more classes One is: ClientProxy and one is a ServerProxy.

In the ServerProxy. public void registerRenderInfo() {

}

and in the ClientProxy it will extends to the ServerProxy for instance its like this:
public class ClientProxy extends ServerProxy {
  
}

-----------------------------------------------
Why can we not import ServerProxy?

Cause we can only import stuff that
is from a different package or somewhere else.

and in ClientProxy then 

@Override (optional)
public void registerRenderInfo() {

}

Now in your MainRegistry we need to add 3 More voids. 1 Is optional. And thats the Init InitializationEvent

Type in mainRegistry:

@EventHandler
public void PreLoad(FMLPreInitializationEvent PreEvent)


{
       proxy.registerRenderInfo();
}




@EventHandler
public void load(FMLInitializationEvent event)
{




}

@EventHandler
public void PostLoad(FMLPostInitializationEvent PostEvent)
{




}

(optional)
(optional)@EventHandler
(optional)public void init(FMLInitializationEvent event)
(optional){
(optional)
(optional}

Now import SidedProxy to cpw.mods.fml.common

Import EventHandler to cpw.mods.fml.common.Mod.
and Import The InitializationEvents to cpw.mods.fml.registry.

You have setted up proxies good job!

Again, what is a proxy? A proxy is if you are trying to run on a client. Or a server.





Bye! Next we are adding ITEMS!!!
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome