Jump to content

Recommended Posts

Posted

In the documentation for 1.12 it mentions proxy classes. However, in 1.13 it doesn't. There are a bunch of changes between the two versions' documentation related to Sides, so with all the changes does that mean that separate Proxy files are no longer needed?

 

I watched a couple of YouTube modding tutorials, and they had me set up the Proxy files, but since they used Common and Client proxies I don't think that's accurate (since Common proxies don't make any sense, and because of the changes in the documentation).

 

However, I've been looking at the Iron Chest mod (since it's open source and updated for 1.13), and they have Server and Client proxies. The Server proxy has only one method aside from preInit (which is empty):

public World getClientWorld()
{
    return null;
}

 

The client proxy has stuff related to rendering the mod's tile entities.

 

They then register it using this (which admittedly I don't understand the intricacies of, but it makes sense): 

public static ServerProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new);

 

However, is this technique the preferred and agreed-upon (in the community) way of doing it?

Posted
Quote

In 1.13, are proxy classes done away with in favor of other methods?

No. You still need proxies. 

 

18 minutes ago, TheKingElessar said:

They then register it using this (which admittedly I don't understand the intricacies of, but it makes sense): 


public static ServerProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> ServerProxy::new);

What you're looking at is called a lambda expression. Well, two. Pointing at references to the constructors for the client and server proxy. It could also be done like this:

 

DistExecutor.runForDist(() -> () -> new ClientProxy(), () -> () -> new ServerProxy());

 

Yes, that's a lambda that points to another lambda. Because what the runForDist method takes as its two arguments are two Supplier<Supplier<T>>s. Supplier<T> is "a functional interface whose functional method is get()." And its used as such:

 

        switch (FMLEnvironment.dist)
        {
            case CLIENT:
                return clientTarget.get().get();
            case DEDICATED_SERVER:
                return serverTarget.get().get();
        }

 

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
1 hour ago, TheKingElessar said:

are Proxy files are no longer needed?

Mostly, they are unnecessary in 90% of cases since they have been replaced by Sided EventSubscribers. They are still needed for specialised behaviour depending on physical side that doesn’t involve events, but most mods don’t need to deal with this stuff.

In the other 10% of cases do what Draco said. However, remember that if it has anything to do with Events, it should be in a sided EventSubscriber, NOT a proxy.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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.