Jump to content

Recommended Posts

Posted
  On 4/29/2020 at 7:02 PM, Ugdhar said:

Post your code, preferrably as a github repo, and debug.log as well, it should give us enough info to figure out why it's not working :)

Expand  

https://pastebin.com/5VUf4rXC

I hope you can see how it should be working, but its not.
Also, idk debug.log, but it just doesn't do the System.out.println() at all. Nothing.
And in this thread again: This event is supposed to call when I get knockback, right? So e.g a player punch me?

Posted
    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public class RegistryEvents {
        @SubscribeEvent
        public void onKb (LivingKnockBackEvent e) {

 

So, two problems.

1) You're using the wrong bus
2) your method isn't static

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
  On 4/29/2020 at 7:51 PM, Draco18s said:
    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public class RegistryEvents {
        @SubscribeEvent
        public void onKb (LivingKnockBackEvent e) {

 

So, two problems.

1) You're using the wrong bus
2) your method isn't static

Expand  

So what should I use? Basically every other events work perfectly in that class, except for that one.

Posted
  On 4/30/2020 at 4:09 PM, Scholler said:

Didn't test it yet, but why wouldn't this event bus work? ._.

Expand  

Think of an event bus like an email address.

If you only get work related emails at your work address, then write a bot to tell you when you have new messages from your boss, but tell it to check your personal email address.

Would you expect it to work?
No?

Why not?

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
  On 4/30/2020 at 4:46 PM, Draco18s said:

Think of an event bus like an email address.

If you only get work related emails at your work address, then write a bot to tell you when you have new messages from your boss, but tell it to check your personal email address.

Would you expect it to work?
No?

Why not?

Expand  

OK I GET IT

Posted

I said you had two problems.

Did you fix both?

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
  On 4/29/2020 at 7:51 PM, Draco18s said:

2) your method isn't static

Expand  

https://lmgtfy.com/?q=java+static+method

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 (edited)
  On 4/30/2020 at 8:42 PM, diesieben07 said:

Post updated code instead of just barking "not working, spoonfeed me more code".

Expand  

I'm trying to get this to work, been trying for more than one day now, and I'm not asking for any code. Probably you think I'm stupid, well, I'm not. Actually you still didn't answer my question, where I asked if this event should get called when I get hit in game, so I take knockback, because I don't see why wouldn't this work. If you want the code, there: https://pastebin.com/EuZkaUUe.
AND if you really want to reply, you should help, not insult me or think that I'm so stupid I don't even know what's static method, or if you can't reply normally, then just don't, dear Forum Team member.

Edited by Scholler
Added important detail
Posted (edited)

So. When I said you needed static, your code looked like this:

    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public class RegistryEvents {
        @SubscribeEvent
        public void onKb (LivingKnockBackEvent e) {

using an annotation.

 

Now it looks like this:

    MinecraftForge.EVENT_BUS.register(new KnockbackR());
...
    public static class KnockbackR { //Tried without static, tried with only the class static.
        public static void onKb(LivingKnockBackEvent e) {
            System.out.println("Called");
            no, not called
        }
    }

Why did you change something I didn't tell you to change? Now the fact that your method is static is the problem.

(The class being static is basically irrelevant, but it should be static anyway, but that's not the method its the class).

 

You HAVE THIS for godsake.

    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public class RegistryEvents {
        @SubscribeEvent
        a normal void WHICH STILL WORKING
    }

Although it appears you couldn't be arsed to show the method signature of a working event, because you also have this for some reason:

        MinecraftForge.EVENT_BUS.register(new RegistryEvents());

So who knows which one of the two registrations is working for the handlers that are working correctly.

Edited by Draco18s

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
  On 4/30/2020 at 9:35 PM, loordgek said:

you need to learn java first before modding

and if you dont know something use google most of the time it has a good answer

Expand  

lmao.

 

  On 4/30/2020 at 9:14 PM, Scholler said:

you should help, not insult me or think that I'm so stupid I don't even know what's static method

Expand  

I see you dont get it

Posted
  On 4/30/2020 at 10:31 PM, Draco18s said:

So. When I said you needed static, your code looked like this:

    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public class RegistryEvents {
        @SubscribeEvent
        public void onKb (LivingKnockBackEvent e) {

using an annotation.

 

Now it looks like this:

    MinecraftForge.EVENT_BUS.register(new KnockbackR());
...
    public static class KnockbackR { //Tried without static, tried with only the class static.
        public static void onKb(LivingKnockBackEvent e) {
            System.out.println("Called");
            no, not called
        }
    }

Why did you change something I didn't tell you to change? Now the fact that your method is static is the problem.

(The class being static is basically irrelevant, but it should be static anyway, but that's not the method its the class).

 

You HAVE THIS for godsake.

    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public class RegistryEvents {
        @SubscribeEvent
        a normal void WHICH STILL WORKING
    }

Although it appears you couldn't be arsed to show the method signature of a working event, because you also have this for some reason:

        MinecraftForge.EVENT_BUS.register(new RegistryEvents());

So who knows which one of the two registrations is working for the handlers that are working correctly.

Expand  

 

  On 4/30/2020 at 10:31 PM, Draco18s said:

So. When I said you needed static, your code looked like this:

    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public class RegistryEvents {
        @SubscribeEvent
        public void onKb (LivingKnockBackEvent e) {

using an annotation.

 

Now it looks like this:

    MinecraftForge.EVENT_BUS.register(new KnockbackR());
...
    public static class KnockbackR { //Tried without static, tried with only the class static.
        public static void onKb(LivingKnockBackEvent e) {
            System.out.println("Called");
            no, not called
        }
    }

Why did you change something I didn't tell you to change? Now the fact that your method is static is the problem.

(The class being static is basically irrelevant, but it should be static anyway, but that's not the method its the class).

 

You HAVE THIS for godsake.

    @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
    public class RegistryEvents {
        @SubscribeEvent
        a normal void WHICH STILL WORKING
    }

Although it appears you couldn't be arsed to show the method signature of a working event, because you also have this for some reason:

        MinecraftForge.EVENT_BUS.register(new RegistryEvents());

So who knows which one of the two registrations is working for the handlers that are working correctly.

Expand  

OK.
Gonna test.

Posted
  On 5/1/2020 at 10:28 AM, Scholler said:

you should help, not insult me or think that I'm so stupid I don't even know what's static method

Expand  

i am not insulting you or call you stupid

i am just telling you to learn java, it will help you in the long run

everybody here needed to learn at some point

Posted
  On 5/1/2020 at 10:28 AM, Scholler said:

lmao.

 

I see you dont get it

Expand  
  Quote

Modder Support

This is the support section for those modding with Forge. Help with modding goes in here, however, please keep in mind that this is not a Java school. You are expected to have basic knowledge of Java before posting here.

Expand  

 

  • Thanks 1

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

no

I have never said I don't even know what a static method is
I said you shouldn't think that I don't know what a static method is
I see you quote the part where I said what you shouldn't think about me, no problem.
I still haven't figured it out, nothing worked, so at this point I'm just kinda searching the internet, and I'm spending less time on coding this mod

Posted
  On 5/2/2020 at 4:30 PM, Scholler said:

I have never said I don't even know what a static method is

Expand  

Right:

 

  On 4/30/2020 at 6:44 PM, Scholler said:

Where am I supposed to put ,,static'' ?

Expand  

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

Rule 1 of asking a question: don't get butthurt when someone points out you don't know shit, that's what you're here to supposedly solve.

 

Rule 2, nobody is even obligated to help you, be courteous.

 

Everything in that doc is plenty to solve your issue, registering an event handler, and subscribing to an event is less than 5 lines of code. That doc outlines what to do depending on the functionality you want, in this case Draco thoroughly explained your method must be static. So when you register your event handler, you must pass in an instance of the class, or you can annotate your class.

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.