Jump to content

Recommended Posts

Posted

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);
}	

}

  • 2 weeks later...
Posted

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/

  • 2 years later...
Posted (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 by zizbird
Added clarification of target audience.
  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Okay so I went to a different version of that mod and it booted right up, thank you
    • C:\Users\bruiser\curseforge\minecraft\Instances\Fazbear Remnants\essential\loader\stage1\launchwrapper\stage2.forge_1.12.2.jar: The process cannot access the file because it is being used by another process. Restart your system and test it again If there is no change, delete the mentioned essential folder or remove the mod essential
    • Does it work with newer versions? For 1.16.5 also make a test with Embeddium + Oculus as Optifine replacement
    • Looking for the best Temu coupon code $100 off? You’re in the right place! We’ve got the ultimate deal that helps you save big on your favorite items. Our exclusive ACS670886 Temu coupon code is perfect for shoppers in the USA, Canada, and Europe. Whether you're a new or existing customer, this code ensures you get maximum benefits. By using the Temu coupon $100 off, you can unlock exciting savings on Temu’s vast collection. Don’t miss this chance to claim your Temu 100 off coupon code today! What Is The Coupon Code For Temu $100 Off? Both new and existing customers can enjoy incredible benefits with our Temu coupon $100 off on the Temu app and website. This $100 off Temu coupon ensures huge savings for everyone! ACS670886 – Get a flat $100 off on selected purchases. ACS670886 – Unlock a $100 coupon pack for multiple uses. ACS670886 – Enjoy a $100 flat discount if you're a new customer. ACS670886 – Existing customers can claim an extra $100 promo code. ACS670886 – This $100 coupon is valid for shoppers in the USA and Canada. Temu Coupon Code $100 Off For New Users In 2025 New users can maximize their savings by applying our Temu coupon $100 off on the Temu app. This Temu coupon code $100 off unlocks amazing deals for first-time shoppers. ACS670886 – Get a flat $100 discount for new users. ACS670886 – Receive a $100 coupon bundle as a welcome offer. ACS670886 – Unlock up to $100 in coupons for multiple uses. ACS670886 – Enjoy free shipping to 68 countries. ACS670886 – Get an extra 30% off on any purchase as a first-time user. How To Redeem The Temu Coupon $100 Off For New Customers? Using the Temu $100 coupon is easy! Follow these steps to redeem your Temu $100 off coupon code for new users: Sign up on the Temu app or website. Browse and add your favorite items to the cart. Enter ACS670886 at checkout. See the $100 discount applied instantly. Complete your purchase and enjoy your savings! Temu Coupon $100 Off For Existing Customers Existing customers can also benefit from our exclusive Temu $100 coupon codes for existing users. Use this Temu coupon $100 off for existing customers free shipping deal and save more! ACS670886 – Get an extra $100 discount for existing users. ACS670886 – Enjoy a $100 coupon bundle for multiple purchases. ACS670886 – Receive a free gift with express shipping across the USA/Canada. ACS670886 – Grab an extra 30% off on top of existing discounts. ACS670886 – Avail free shipping to 68 countries. How To Use The Temu Coupon Code $100 Off For Existing Customers? Redeeming your Temu coupon code $100 off as an existing user is simple. Just follow these steps: Log in to your Temu account. Select your desired products and add them to your cart. Apply ACS670886 at checkout. Your Temu coupon $100 off code will be applied automatically. Confirm your order and enjoy massive savings! Latest Temu Coupon $100 Off First Order First-time buyers get the best deals with our Temu coupon code $100 off first order. This Temu coupon code first order ensures maximum savings. ACS670886 – Flat $100 discount for the first order. ACS670886 – Special $100 Temu coupon code for new customers. ACS670886 – Get up to $100 in coupons for multiple uses. ACS670886 – Free shipping to 68 countries. ACS670886 – Extra 30% off on any first-time purchase. How To Find The Temu Coupon Code $100 Off? Finding a Temu coupon $100 off is easy! Check out the Temu coupon $100 off Reddit section or follow these tips: Subscribe to the Temu newsletter for exclusive deals. Follow Temu’s official social media pages for the latest updates. Visit trusted coupon sites for verified and working codes. Is Temu $100 Off Coupon Legit? Yes, our Temu $100 Off Coupon Legit and verified! Wondering if the Temu 100 off coupon legit? Here’s why: The ACS670886 code is officially tested and confirmed. Valid for all customers in the USA, Canada, and Europe. No expiration date—use it anytime! How Does Temu $100 Off Coupon Work? The Temu coupon code $100 off first-time user works instantly upon applying at checkout. Simply enter the Temu coupon codes 100 off, and the discount is automatically deducted. How To Earn Temu $100 Coupons As A New Customer? To earn a Temu coupon code $100 off, sign up on Temu, make your first purchase, and refer friends. This 100 off Temu coupon code can be unlocked through special promotions. What Are The Advantages Of Using The Temu Coupon $100 Off? $100 discount on the first order $100 coupon bundle for multiple uses 70% discount on popular items Extra 30% off for existing customers Up to 90% off on selected products Free gifts for new users Free delivery to 68 countries Temu $100 Discount Code And Free Gift For New And Existing Customers Enjoy the Temu $100 off coupon code and get amazing benefits! Our $100 off Temu coupon code ensures huge savings. ACS670886 – $100 discount for the first order. ACS670886 – Extra 30% off on any item. ACS670886 – Free gift for new Temu users. ACS670886 – Up to 70% discount on all Temu items. ACS670886 – Free shipping in 68 countries including the USA and UK. Final Note: Use The Latest Temu Coupon Code $100 Off Using the Temu coupon code $100 off is the smartest way to save on Temu! Don’t wait—grab your discount now. Our Temu coupon $100 off is available for all customers, ensuring maximum savings. Get yours today! FAQs Of Temu $100 Off Coupon Q: How can I get the Temu $100 off coupon? A: Use code ACS670886 at checkout to claim your $100 discount. Q: Is the Temu $100 coupon valid for existing customers? A: Yes! Existing users can also apply ACS670886 and enjoy savings. Q: Does the Temu $100 off coupon have an expiration date? A: No, ACS670886 is valid indefinitely. Q: Can I use the Temu coupon on multiple orders? A: Yes! ACS670886 allows multiple redemptions. Q: Is the Temu $100 coupon applicable worldwide? A: Yes, it’s valid in the USA, Canada, Europe, and 68 other countries.
    • I tried both Vanilla and Optfine like you said, and both gave the same result. So I believe the issue is most likely with Minecraft in general and not Forge
  • Topics

×
×
  • Create New...

Important Information

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