Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

:) sorry i'm korean i can't write english very well..

i want to on Right-click event get aiming target class. (Player or Monster All..)

How to? Please Answer me T__T

 

qP8uTG6.png

Look into the EntityEndermen file. The Endermen notice you if you look at him.

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

someVariable.class

?

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.

Then use the

EntityInteractEvent

and check if the

target

given by the Event is a player

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

  • Author

someVariable.class

?

sorry, i can't english very well..

 

When Right Click Other Player, I want to Get that this Player Object class..

 

or, if right click Zombie, I want to Get Zombie Object class

 

 

BTW

 

@jmylifecolor I highly recommend you to learn english when posting to any english forums. Just a suggesion. Have a nice day. :)

Sorry, if you find mistaches in my posts.

I am not EN.

And when I post anything on Modder support, it means, I can't help myself and I need your help. And when you decide to delete my topic, just PM me with the reason, please.

As mentioned, whenever you are trying to intercept vanilla behavior you should see if there is an event that can help you. Forge has provided a lot of events for the common things that people would like to modify such as breaking blocks, interacting with entities, joining a world, and so on.

 

In this case the event you need to handle is EntityInteractEvent. You need to write a handler method that is annotated to subscribe to the event bus, you need the class with the method to be registered as an event handling class, and inside the method you can take the event parameter that is passed in and look at its fields. It will tell you the entity that is being interacted with, and you can then check what class the entity is.

 

I have a tutorial on handling events: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

BTW

 

@jmylifecolor I highly recommend you to learn english when posting to any english forums. Just a suggesion. Have a nice day. :)

 

Well his English is better than our Korean! I don't think English is the problem, I think he just isn't that familiar with modding, especially event handling, and maybe programming.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

There are a few concepts that aren't making it across the translation barrier.

 

The first has to do with programming in general (not that I think that jmylifecolor doesn't know java or how to program, but rather that the terminology itself may not be translating correctly).  The second has to deal with event handlers, which are a little arcane if you haven't used them before.

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.

  • Author

Oh! i have Object-Oriented Programming(JAVA,C#) Skill. but, i think  my english expression is problem.

 

I understand the event. just i want to get target's classes(EntityPlayerMP) when i click right button to other user(target)..

 

today first time I tried Forge-Programming.  sorry.

 

Thanks to everyone Answer.

 

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.