Jump to content

Recommended Posts

Posted

package com.FirstArchon.RedStoneium;
import com.FirstArchon.RedStoneium.handler.ConfigurationHandler;
import com.FirstArchon.RedStoneium.proxy.Iproxy;
import com.FirstArchon.RedStoneium.reference.Reference;
import cpw.mods.fml.common.Mod;
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;

@Mod(modid = Reference.MOD_ID , name = Reference.MOD_NAME ,version = Reference.VERSSION, guiFactory = Reference.GUI_FACTORY_CLASS )



public class RedStoneium {

@Mod.Instance(Reference.MOD_ID)
public static RedStoneium instance;

@SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS , serverSide = Reference.SERVER_PROXY_CLASS)
public static Iproxy proxy;



@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
ConfigurationHandler.init(event.getSuggestedConfigurationFile());

}

@Mod.EventHandler
public void Init(FMLInitializationEvent event) {

}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {

}
}



package com.FirstArchon.RedStoneium.reference;

public class Reference {
public static final String MOD_ID  = "RedStoneium";
public static final String MOD_NAME = "Redstoneium";
public static final String VERSSION = "1.7.10-1.0";
public static final String CLIENT_PROXY_CLASS = "com.FirstArchon.RedStoneium.proxy.ClientProxy";
public static final String SERVER_PROXY_CLASS = "com.FirstArchon.RedStoneium.proxy.ServerProxy";
public static final String GUI_FACTORY_CLASS = "com.FirstArchon.RedStoneium.client.gui.GuiFactory";



}

package com.FirstArchon.RedStoneium.proxy;

public interface Iproxy {

}

package com.FirstArchon.RedStoneium.proxy;

public class CommonProxy implements Iproxy {

}

package com.FirstArchon.RedStoneium.proxy;

public class ClientProxy {

}

package com.FirstArchon.RedStoneium.proxy;

public class ServerProxy extends CommonProxy {

}

 

these are all the classes that effect the proxy. I didn't change any of this for a while though. I changed the Guifactroy to take advantage of the new config options in 1.7.10 and then it wouldn't start anymore.

Posted

I'm pretty sure this isn't right... where's your implements?

public class ClientProxy {

 

As a matter of interest, why the extra complication of IProxy?  Client and Server extending Common, with public static CommonProxy proxy, will work just as well and be less complicated?

 

Also, Capital letters in your Mod ID and package names is going to cause you grief sooner or later.  Packages should always be lower case by convention, and I've seen quite a few subtle bugs arise because the Mod ID had upper case letters.  :)

 

-TGG

 

 

 

Posted

oops that was  it that should have been

public class ClientProxy extends CommonProxy

I don't fully understand it myself because I'm following a tutorial. as I uderstand it  commonproxy is a implementation of iproxy. common will be what server and client have in common. client and server proxies inherit the contents of common and then you add whatever u want to them.

Posted

oops that was  it that should have been

public class ClientProxy extends CommonProxy

I don't fully understand it myself because I'm following a tutorial. as I uderstand it  commonproxy is a implementation of iproxy. common will be what server and client have in common. client and server proxies inherit the contents of common and then you add whatever u want to them.

 

You don't actually need IProxy or ServerProxy.  IProxy here is pointless and generally speaking your "server" proxy is actually the Common proxy.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I don't fully understand it myself because I'm following a tutorial. as I uderstand it  commonproxy is a implementation of iproxy. common will be what server and client have in common. client and server proxies inherit the contents of common and then you add whatever u want to them.

This link might help you understand how Proxy works

http://greyminecraftcoder.blogspot.com.au/2013/11/how-forge-starts-up-your-code.html

 

-TGG

 

Posted

What the IProxy? It's just his way of doing things.

 

You just need 2 classes, the common proxy (or server proxy) and the client proxy, which extends the common proxy. That's all. You don't need any fancy interfaces, just use the common proxy. IProxy is just a waste of space.

 

Granted, very little space, but it's still a waste of space.

-Mitchellbrine

 

Minecraft can do ANYTHING, it's coded in Java and you got the full power of Java behind you when you code. So nothing is impossible.

It may be freaking fucking hard though, but still possible ;)

 

If you create a topic on Modder Support, live by this motto:

I don't want your charity, I want your information
Posted

Ok, I'll grant that that is a valid point.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Actually IProxy (or rather Proxy as an interface, I prefixes are stupid) has a reason. If you need to access @SideOnly(SERVER) code you need a separate ServerProxy to be 100% correct.

Then you have Proxy and ServerProxy and ClientProxy implement that. The concept of a "CommonProxy" I find rather weird and stupid. Proxies are designed to access side-specific code, not common code.

It's not weird or stupid at all. 

ClientProxy = code for {client+integrated server} only

ServerProxy = code for dedicated server only

CommonProxy = code for both {client+integrated server} and dedicated server

Seems very logical to me.  Purely a matter of taste whether your common code goes in a CommonProxy base class or stays in your Mod class.  If there's no code in CommonProxy you may as well use IProxy instead of CommonProxy (but not both as per OP code).

 

-TGG

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.