Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.7.10] Issues with Proxies
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 1
ravingmadlunatic

[1.7.10] Issues with Proxies

By ravingmadlunatic, March 3, 2015 in Modder Support

  • Start new topic

Recommended Posts

ravingmadlunatic    0

ravingmadlunatic

ravingmadlunatic    0

  • Tree Puncher
  • ravingmadlunatic
  • Members
  • 0
  • 5 posts
Posted March 3, 2015

Before I start, I would like to say that I am new to programming in java so I apologize if I get any terminology wrong.

 

I've been following bedrockminers tutorial for proxies which can be found here: http://bedrockminer.jimdo.com/modding-tutorials/basic-modding/proxies/

 

I created the CommonProxy class and this is where I have gotten stuck. His code has the FLM initialization events in them but without importing those events.

 

package com.bedrockminer.tutorial;

public class CommonProxy {

    public void preInit(FMLPreInitializationEvent e) {

    }

    public void init(FMLInitializationEvent e) {

    }

    public void postInit(FMLPostInitializationEvent e) {

    }
}

 

I found that I cannot go on to the next step without importing the events.

 

In addition, eclipse does not seem to understand the @SidedProxy annotation.

 

@SidedProxy(clientSide="com.bedrockminer.tutorial.ClientProxy", serverSide="com.bedrockminer.tutorial.ServerProxy")
public static CommonProxy proxy;

 

When I add this code to the main class, @sidedproxy invokes a "cannot be resolved to a type" error.

 

I realize, in hindsight, i'm probably in way over my head at this point. My knowledge of Java is incredibly rudimentary. Still, I would like to work towards an understanding of what I am doing wrong.

 

Here is my code for the Main.java, ClientProxy.java, ServerProxy.java, and CommonProxy.java classes. The name of the package differ from his code and mine.

 

Main.java

package com.ravingmadlunatic.birds;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;

@Mod(modid = Main.MODID, name = Main.MODNAME, version = Main.VERSION)
public class Main {

        public static final String MODID = "birds";
        public static final String MODNAME = "Realistic Bird Mod";
        public static final String VERSION = "1.0.0";
        
        @Instance
        public static Main instance = new Main();
        
        /**
         * Run before anything else. Read your config, create blocks, items, etc, and 
         * register them with the GameRegistry.
         */
       
        @SidedProxy(clientSide="com.ravingmadlunatic.birds.CombinedClientProxy", serverSide="com.ravingmadlunatic.birds.DedicatedServerProxy")
        public static CommonProxy proxy;
        
        @EventHandler
        public void preInit(FMLPreInitializationEvent e) {
        	this.proxy.preInit(e);
        }
        
        /**
         * Do your mod setup. Build whatever data structures you care about. Register recipes.
         */
        @EventHandler
        public void init(FMLInitializationEvent e) {
        	this.proxy.init(e);
                
        }
        
        /**
         * Handle interaction with other mods, complete your setup based on this.
         */
        @EventHandler
        public void postInit(FMLPostInitializationEvent e) {
        	this.proxy.postInit(e);
        
        }
}

 

CommonProxy.java

package com.ravingmadlunatic.birds;

public class CommonProxy {

    public void preInit(FMLPreInitializationEvent e) {

    }

    public void init(FMLInitializationEvent e) {

    }

    public void postInit(FMLPostInitializationEvent e) {

    }
  
}

 

ServerProxy.java

package com.ravingmadlunatic.birds;

public class ServerProxy extends CommonProxy {

/* (non-Javadoc)
 * @see com.ravingmadlunatic.birds.CommonProxy#preInit(cpw.mods.fml.common.event.FMLPreInitializationEvent)
 */
@Override
public void preInit(FMLPreInitializationEvent e) {
	// TODO Auto-generated method stub
	super.preInit(e);
}

/* (non-Javadoc)
 * @see com.ravingmadlunatic.birds.CommonProxy#init(cpw.mods.fml.common.event.FMLInitializationEvent)
 */
@Override
public void init(FMLInitializationEvent e) {
	// TODO Auto-generated method stub
	super.init(e);
}

/* (non-Javadoc)
 * @see com.ravingmadlunatic.birds.CommonProxy#postInit(cpw.mods.fml.common.event.FMLPostInitializationEvent)
 */
@Override
public void postInit(FMLPostInitializationEvent e) {
	// TODO Auto-generated method stub
	super.postInit(e);
}

 

ClientProxy.java

package com.ravingmadlunatic.birds;

public class ClientProxy extends CommonProxy {

/* (non-Javadoc)
 * @see com.ravingmadlunatic.birds.CommonProxy#preInit(cpw.mods.fml.common.event.FMLPreInitializationEvent)
 */
@Override
public void preInit(FMLPreInitializationEvent e) {
	// TODO Auto-generated method stub
	super.preInit(e);
}

/* (non-Javadoc)
 * @see com.ravingmadlunatic.birds.CommonProxy#init(cpw.mods.fml.common.event.FMLInitializationEvent)
 */
@Override
public void init(FMLInitializationEvent e) {
	// TODO Auto-generated method stub
	super.init(e);
}

/* (non-Javadoc)
 * @see com.ravingmadlunatic.birds.CommonProxy#postInit(cpw.mods.fml.common.event.FMLPostInitializationEvent)
 */
@Override
public void postInit(FMLPostInitializationEvent e) {
	// TODO Auto-generated method stub
	super.postInit(e);
}	

}

Share this post


Link to post
Share on other sites

diesieben07    7590

diesieben07

diesieben07    7590

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7590
  • 54991 posts
Posted March 3, 2015

You will have to import, there is no way around it and nothing wrong with it either.

Share this post


Link to post
Share on other sites

ravingmadlunatic    0

ravingmadlunatic

ravingmadlunatic    0

  • Tree Puncher
  • ravingmadlunatic
  • Members
  • 0
  • 5 posts
Posted March 13, 2015

Thank you for letting me know!

Share this post


Link to post
Share on other sites

jabelar    593

jabelar

jabelar    593

  • Reality Controller
  • jabelar
  • Members
  • 593
  • 3266 posts
Posted March 13, 2015

I think one of the most important things when beginning with Java and/or modding is to learn to use your IDE (e.g. Eclipse) effectively.  A good IDE will give flag the majority of errors, will give you good suggestions on how to fix things, and allow you to follow the call hierarchy back through the vanilla code.

 

For example, in Eclispe in the preferences for java code style you can set it up so it will automatically insert @Override statements.  I find this is really useful because it is very easy to write a method in your custom class which you think should override but you mess it up slightly essentially creating a different method that won't be called.

 

You can also set up Eclipse to automatically put in imports, at least for the cases where it can uniquely resolve them, and take out unused imports.

 

You can right-click on a method and choose "Call Hierarchy" and it will show you all the other code that calls the method.  I highly suggest you spend a couple hours following the call hierarchies for the vanilla code -- like take a vanilla block class and select a method in its code and find out what calls it.  This is hugely useful as a modder because the API isn't well documented so you often have to go into the vanilla code to confirm that it does what you expect.  You'll also get a lot of coding ideas by exploring the code call hierarchies.

 

You can right-click on any type, method or class and choose "Declaration" and it will take you to the code for that item.

 

Anyway, I'm just saying to check out the various preferences in your IDE and learn to use it proficiently.  Then you'll be able to correct most coding mistakes yourself without relying on the forum here!


Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Share this post


Link to post
Share on other sites

zizbird    0

zizbird

zizbird    0

  • Tree Puncher
  • zizbird
  • Members
  • 0
  • 7 posts
Posted January 21, 2018 (edited)

No better way to learn the IDE than working a project, IMO.

 

I see this conversation is from years ago, but I was just now having the same problem starting out modding for Minecraft 1.12.2, including the problem the OP mentioned wherein "eclipse does not seem to understand the @SidedProxy annotation" so I'm posting for everyone reading this who's still running into this problem.

 

The error I was getting was "SidedProxy cannot be resolved to a type".

Not sure if this is the right solution, but I added this to my Main and it removed the error message:

 

import net.minecraftforge.fml.common.SidedProxy;

 

HTH.

-ziz

 

Edited January 21, 2018 by zizbird
Added clarification of target audience.

Share this post


Link to post
Share on other sites

Kokkie    55

Kokkie

Kokkie    55

  • Dragon Slayer
  • Kokkie
  • Forge Modder
  • 55
  • 796 posts
Posted January 21, 2018
5 hours ago, zizbird said:

I see this conversation is from years ago

Then why post here?

5 hours ago, zizbird said:

but I was just now having the same problem starting out modding for Minecraft 1.12.2

Create your own topic.

 


Classes: 94

Lines of code: 12173

Other files: 206

Github repo: https://github.com/KokkieBeer/DeGeweldigeMod

Share this post


Link to post
Share on other sites

diesieben07    7590

diesieben07

diesieben07    7590

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7590
  • 54991 posts
Posted January 21, 2018
8 hours ago, Kokkie said:

Create your own topic.

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • poopoodice
      Adding jar files to existing environment

      By poopoodice · Posted 19 minutes ago

      It's been discussed for a long time, but none of the solutions worked for me (maybe I did not did them right). So I have created another mod (basically a tool) and I want to use it in another environment, this is what I've tried:   1. run normal build ./gradlew.bat build, and then put built jar from lib into the mods folder. 2. run jar build ./gradlew.bat jar, and then put built jar from reobfJar into the mods folder. 3. build jar using existing ide options, and then put built jar from lib into the mods folder.   1 & 2 causes crashes, and 3 does not work at all (not detected).   What is the correct way of doing it in 1.16.4? Thanks.
    • Draco18s
      GUI Documentation

      By Draco18s · Posted 45 minutes ago

      GUIs aren't that difficult. There's dozens of tutorials for them and they haven't really changed all that much in ten years.
    • Xenfo
      Mod Blocker

      By Xenfo · Posted 1 hour ago

      Any mod blockers that actually work? Please link them if yes.
    • diesieben07
      Tessellator ignores lighting?

      By diesieben07 · Posted 1 hour ago

      Neither 1.10 now 1.14 are supported here. Please refer to the supported versions page: https://forums.minecraftforge.net/topic/91712-supported-version-directory/
    • CookieLukas
      Tessellator ignores lighting?

      By CookieLukas · Posted 1 hour ago

      Oh,  sorry, the code was 1.10.2, but as its not allowed here, I updated it to 1.14.4.
  • Topics

    • poopoodice
      0
      Adding jar files to existing environment

      By poopoodice
      Started 19 minutes ago

    • T1ps
      3
      GUI Documentation

      By T1ps
      Started Tuesday at 10:14 PM

    • Xenfo
      0
      Mod Blocker

      By Xenfo
      Started 1 hour ago

    • CookieLukas
      3
      Tessellator ignores lighting?

      By CookieLukas
      Started 2 hours ago

    • Extrodonary
      1
      Forge isn't working on Minecraft Realms

      By Extrodonary
      Started 1 hour ago

  • Who's Online (See full list)

    • Shai
    • Luis_ST
    • Pinary
    • byel3606
    • arch12
    • StealthyNoodle
    • bananapizzuh
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.7.10] Issues with Proxies
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community