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

Hello, everyone.
I am a newbie in "java" "forge" "gradle".
Recently I want to listen to the player's health and will perform some actions once it changes. I found the file from "
CombatEntry" method from " net.minecraft.world.damagesource.CombatEntry" but when I write the behavior to listen in my class, idea prompts me "Cannot resolve symbol 'getDamage'"

  • main.java
@Mod(Utils.MOD_ID)
@Mod.EventBusSubscriber()
public class Main {
    public static DamageSource a;
    public static int b;
    public static float c;
    public static float d;
    public static String e;
    public static float f;
    @SubscribeEvent
    public static void Demo02(getDamage) {
        //CombatEntry combatEntry = new CombatEntry(a,b,c,d,e,f);
        System.out.println("sadawedawdawdawdadwa" + c);
    }
}

Is it because "forge" doesn't support "minecraft" native events, or is "getDamage" not an event that can be listened to?

first of all basic java is required for modding minecraft
 

21 minutes ago, iYM8jXCs3pcvblTE said:

Is it because "forge" doesn't support "minecraft" native events

what did you mean by native events?

21 minutes ago, iYM8jXCs3pcvblTE said:

or is "getDamage" not an event that can be listened to?

getDamage is a method not a class nor an Event

Edited by Luis_ST

  • Author

Yes, I'm sorry, I just realized that the previous "AttackEntityEvent" was a class/event. And "getDamage" is a method. That's why I couldn't listen to this event. I have understood the reason.
Native events, meaning events from "minecraft", not "forge" or other third party events. (Ultimately what I want to say is whether "forge" can only call/listen to events from "forge" and not from "minecraft", or whether "minecraft" has no event system)
When I checked the "forge" event system in the past two days, I didn't find any events related to listening to player health, is this because if you want to listen to player health, you can only listen to it from events that may cause damage. (For example, when the player falls, I can only insert the action I want to perform into the method that will calculate the fall damage)

Edited by iYM8jXCs3pcvblTE

  • Author
18 minutes ago, Luis_ST said:

first of all basic java is required for modding minecraft
 

what did you mean by native events?

getDamage is a method not a class nor an Event

Yes, I'm sorry, I just realized that the previous "AttackEntityEvent" was a class/event. And "getDamage" is a method. That's why I couldn't listen to this event. I have understood the reason.
Native events, meaning events from "minecraft", not "forge" or other third party events. (Ultimately what I want to say is whether "forge" can only call/listen to events from "forge" and not from "minecraft", or whether "minecraft" has no event system)
When I checked the "forge" event system in the past two days, I didn't find any events related to listening to player health, is this because if you want to listen to player health, you can only listen to it from events that may cause damage. (For example, when the player falls, I can only insert the action I want to perform into the method that will calculate the fall damage)

Edited by iYM8jXCs3pcvblTE

1 minute ago, iYM8jXCs3pcvblTE said:

Native events, meaning events from "minecraft", not "forge" or other third party events.

there are no Events from vanilla, all Events are added by Forge

 

2 minutes ago, iYM8jXCs3pcvblTE said:

When I checked the "forge" event system in the past two days, I didn't find any events related to listening to player health, is this because if you want to listen to player health, you can only listen to it from events that may cause damage.

there is LivingHealEvent

  • Author
12 minutes ago, Luis_ST said:

there are no Events from vanilla, all Events are added by Forge

 

there is LivingHealEvent

OK, I have understood what you are trying to say and thank you very much for your patience in answering the almost common sense questions of the rookies.

:)

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.