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

Knockback event...


Recommended Posts

9 minutes ago, 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 :)

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?

Link to post
Share on other sites
    @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.

Link to post
Share on other sites
11 hours ago, 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

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

Link to post
Share on other sites
36 minutes ago, Scholler said:

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

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.

Link to post
Share on other sites
32 minutes ago, 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?

OK I GET IT

Link to post
Share on other sites

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.

Link to post
Share on other sites
23 hours ago, Draco18s said:

2) your method isn't static

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.

Link to post
Share on other sites
34 minutes ago, diesieben07 said:

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

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
Link to post
Share on other sites

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.

Link to post
Share on other sites
12 hours ago, 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

lmao.

 

13 hours ago, Scholler said:

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

I see you dont get it

Link to post
Share on other sites
12 hours ago, 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.

 

12 hours ago, 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.

OK.
Gonna test.

Link to post
Share on other sites
1 hour ago, Scholler said:

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

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

Link to post
Share on other sites
3 hours ago, Scholler said:

lmao.

 

I see you dont get it

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.

 

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

Link to post
Share on other sites

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

Link to post
Share on other sites
46 minutes ago, Scholler said:

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

Right:

 

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

Where am I supposed to put ,,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.

Link to post
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.



×
×
  • Create New...

Important Information

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