Jump to content

Recommended Posts

Posted

I did a small mod for testing with one simple event h andler. It works* until i build it to jar (with gradlew build) and put it in folder.

This is what the build outputs:build.txt

The mod itself: https://github.com/satyd/TestMod1 

*I have no problems/bugs when i compile it, everything works how it supposed to do.

Can someone help me, what i did wrong?

Posted
2 minutes ago, diesieben07 said:

What is the behavior if you use the jar file?

Just nothing happens. When I run compiled minecraft, it applies potion effect whenever a player kills a mob. With jar it stands still.

Posted
2 minutes ago, diesieben07 said:

That's.... thats not how Java works.

If src did not have that method all the time, your code would not compile

NoSuchMethodException is something thrown by reflection code.

I got this exception when bat suffocated maybe because of gravel. Blocks dont have this method, but living entities do.

But ok let's say there is a problem, then why it works properly when compiled?

Posted
36 minutes ago, diesieben07 said:

Show the stacktrace.

 

The actual game is obfuscated. When you run the build task, ForgeGradle reobfuscates your mod, updating references to Minecraft's methods and fields. But since you use "getTrueSource" in a string, this will not be updated. In the normal game there won't be a method called "getTrueSource", so your event handler always bails out.

I removed this part and tried to repeat this issue, but seems like everything is working.

That time i got this:crash-2020-05-11_21.37.49-server.txt

Posted
6 minutes ago, mdcby said:

I removed this part and tried to repeat this issue, but seems like everything is working.

That time i got this:crash-2020-05-11_21.37.49-server.txt

Are you using deobfuscated names for reflection, because that's very wrong. If you are replace them with the names from MCP. (Incase you don't know what deobfuscated and obfuscated means,getTrueSource -> func_76346_g)

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Posted
8 minutes ago, diesieben07 said:

They are not. NoSuchMethodError is not something reflection produces.

 

You did not use the gradle build task to build your mod.

ohh maybe i really didn't use gradle build without this check, since it works now then thanks ?

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.