Jump to content

Recommended Posts

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?

Posted (edited)

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
Posted (edited)

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
Posted (edited)
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
Posted
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

  • Thanks 1
Posted
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...

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