Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.15.1] How to make a custom entity?


DragonITA
 Share

Recommended Posts

33 minutes ago, diesieben07 said:

You would know this if you had read the (already linked) documentation:

On 1/5/2020 at 1:54 PM, diesieben07 said:

I read it, only dont have see the difference between client physical side and client logical side.

this is what my IDE shows me (Tried to look at a vanilla code):

@net.minecraftforge.api.distmarker.OnlyIn(value=net.minecraftforge.api.distmarker.Dist.CLIENT)

I know it's exactly the same. But I don't understand that, even with the link you've already given. I just find it hard to understand that, and except for these four differences I don't understand at all. Why do you say I can't do it this way, but the vanilla code does exactly that? Could you explain it to me (And yes, I repeat, I read the link and still don't understand it)?

New in Modding? == Still learning!

Link to comment
Share on other sites

8 minutes ago, DragonITA said:

I read it, only dont have see the difference between client physical side and client logical side.

A more modern name for physical side is "distribution".

 

This is the physical client (client distribution):
image.png.0820c9f02aa62ed957151d303e846c1c.png

When you start a single-player world it starts a logical client and a logical server (the integrated server). The distribution remains client, even for the integrated server. You don't suddenly have a dedicated server running.

When you connect to a server it starts a logical client.

 

This is the physical server (server distribution):

image.png.83f15c573a349cbf20abd8690109f69b.png

It only contains one logical side: The server. The distribution is always server.

 

10 minutes ago, DragonITA said:

My IDE don‘t find the FMLEnvironment.dist. I think it was outdated. How was I supposed to do it?

Well, it definitely exists.

 

15 minutes ago, DragonITA said:

Why do you say I can't do it this way, but the vanilla code does exactly that? Could you explain it to me (And yes, I repeat, I read the link and still don't understand it)?

@OnlyIn is a forge thing. Vanilla does not have this.

During setup, forge merges the minecraft client jar and the server jar together (the two distributions, see the images above if you don't know the difference) to create one codebase.

However the code is not identical of course, some things (like GUIs or world rendering) only exist on the client. These things are marked by forge using @OnlyIn to signify "I only found this in distribution X".

  • Thanks 1
Link to comment
Share on other sites

 

2 minutes ago, diesieben07 said:

However the code is not identical of course, some things (like GUIs or world rendering) only exist on the client. These things are marked by forge using @OnlyIn to signify "I only found this in distribution X".

(Similarly some things may only exist in the dedicated server distribution, but is going to be a much, much shorter list that is largely irrelevant for modding).

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.

Link to comment
Share on other sites

21 minutes ago, diesieben07 said:

A more modern name for physical side is "distribution".

 

This is the physical client (client distribution):
image.png.0820c9f02aa62ed957151d303e846c1c.png

When you start a single-player world it starts a logical client and a logical server (the integrated server). The distribution remains client, even for the integrated server. You don't suddenly have a dedicated server running.

When you connect to a server it starts a logical client.

 

This is the physical server (server distribution):

image.png.83f15c573a349cbf20abd8690109f69b.png

It only contains one logical side: The server. The distribution is always server.

 

Well, it definitely exists.

 

@OnlyIn is a forge thing. Vanilla does not have this.

During setup, forge merges the minecraft client jar and the server jar together (the two distributions, see the images above if you don't know the difference) to create one codebase.

However the code is not identical of course, some things (like GUIs or world rendering) only exist on the client. These things are marked by forge using @OnlyIn to signify "I only found this in distribution X".

Wow, thanks for that answer. Now I understand everything except for one point: Why can't I use @OnlyIn and what should I replace it with (the docs is really outdated soon and I don't know what to use now. Strange, when I pressed ctrl + spacebar in the IDE, then normal white comes up with a whole bunch of variables/functions I can use, but I haven't seen any FMLEnvironment.Dist)? If it is, then how should I use it? Usually my IDE tells me, but I don't see anything.

New in Modding? == Still learning!

Link to comment
Share on other sites

1 minute ago, DragonITA said:

Why can't I use @OnlyIn

You can, it's just the wrong tool. You can mark methods or classes as @OnlyIn all you want, it doesn't make your problem go away. Because if you mark something as @OnlyIn, you can not reference it from common code anymore (just like you can't do that with vanilla classes marked @OnlyIn). This is because, as explained above, things marked @OnlyIn are removed from the compiled code without a trace (or in the case of vanilla re not there in the first place). Referencing them when this is the case will produce an Error from the JVM (such as NoClassDefFoundError).

Use @EventBusSubscriber with a Dist argument or DistExecutor to create distribution-specific code.

  • Like 1
Link to comment
Share on other sites

8 minutes ago, DragonITA said:

Like this:???


@EventBusSubscriber(modid = Main.MODID, bus = EventBusSubscriber.Bus.MOD, value = FMLEnvironment.Dist)
public class Something(){
//Do something
}

 

value needs to be a Dist. That is an enum. FMLEnvironment.Dist is not a thing. FMLEnvironment.dist returns the current distribution in form of a Dist value.

Link to comment
Share on other sites

  • 3 weeks later...
On 1/8/2020 at 4:45 PM, DragonITA said:

I resolved it.

Can you please show your solution or tell me the name of the official java-class, that calls "registerEntityRenderingHandler" to register entity renderers?

I don´t know how to find this file, if i don´t know it´s name..

Edited by Drachenbauer
  • Like 1
Link to comment
Share on other sites

12 hours ago, Drachenbauer said:

I don´t know how to find this file, if i don´t know it´s name..

IntelliJ allows you to “search by symbol”.
Example here

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)

Link to comment
Share on other sites

15 hours ago, Drachenbauer said:

Can you please show your solution or tell me the name of the official java-class, that calls "registerEntityRenderingHandler" to register entity renderers?

I don´t know how to find this file, if i don´t know it´s name..

I was just stupid there, I had to enter my EntityType, but I didn't know where it was. After some searching I found my EntityType, changed it correctly and then I didn't get this output anymore, which told me that my parameters were wrong. But if it really works I don't know because I can't test it (have a problem and don't know how to solve it). If you can help me: https://www.minecraftforge.net/forum/topic/79763-1151-why-does-minecraft-crash-when-i-try-to-spawn-my-entity/page/2/?tab=comments#comment-381670. If I understood it well, then just write registerEntiyRendering, then ctrl + Space and it should automatically do what you want.

New in Modding? == Still learning!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.