Jump to content

Why does it need to be in a double and static or final when using numbers in when applying health to mob


Recommended Posts

Posted

Ok, I have a mob that is divided to 7 different breeds or kinds, I want these breeds to have different healths, I cannot use static because I cannot override a subclass especially final using a switch won't work either. I found some mods that made it possible yet using json files?

Posted
54 minutes ago, TheRPGAdventurer said:

Ok, I have a mob that is divided to 7 different breeds or kinds, I want these breeds to have different healths, I cannot use static because I cannot override a subclass especially final using a switch won't work either. I found some mods that made it possible yet using json files?

Why dont you define your Maxhealth in the constructor? Please post some code to help us understand

Posted
Just now, diesieben07 said:

I am assuming you are talking about getBreedHealth? If so, just make it not-static and you can override it. You know what static means, right?

I tried using it without static and it gave me 1 health instead of the one I made it to

Posted
Just now, diesieben07 said:

I am assuming you are talking about getBreedHealth? If so, just make it not-static and you can override it. You know what static means, right?

If it's not static or final, it just won't spawn or give me 1 HP

Posted
Just now, diesieben07 said:

Where do you call this method? Where do you apply this health value?

 

Just now, diesieben07 said:

Where do you call this method? Where do you apply this health value?

I was applying it in apply entity attribute  but removed it lately, 

Posted
Just now, diesieben07 said:

Ok. Where is the code that spawns the dragon? Where is the health value set?

gonna update it back to where I was trying to do it, dragon is spawned via dragonegg block remember? DragonMounts? (DragonEggBlockHandler) sorry for typing too fast, my mom doesn't wanna see me something that has do with minecraft kinda personal, she's gone now tho.

Posted
Just now, diesieben07 said:

Ok. Where is the code that spawns the dragon? Where is the health value set?

ok got it! You just need to ensure it's static or final when applying health to mobs or other attributes

    public static double getBreedHealth() {   	
    	EnumDragonBreed end = EnumDragonBreed.END;
    	EnumDragonBreed nether = EnumDragonBreed.NETHER;
    	if(end != null) {
    		return 100;
    	} else if(nether != null) {
    		return 95;
    	}
    	return 85.0D;	
    }

 

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.