Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by CorruptedCookies, Jun 16, 2020.
I'm trying to make an aggressive ender dragon, How would I achieve this?
Freshly added in 1.15.2
Otherwise it's gonna be very hard.
I am using 1.15.2, how could I make it attack though? Could you give me some example code?
You can manually change the phase. Anything else requires complicated nms stuff.
How would you change the phase? I'm kind of new to java/spigot API
How would I write the line that changes the state? this is mostly what is confusing me the most
This is pretty basic. If you don't know how to do that then I suggest you do something else (java tutorials) first.
Could I at least get the answer? I've just never seen this done before and don't know how to figure it out
I'm not giving you full (copyable) code. Instead here's some pseudo code
get the end battle (hint: the world has a reference to it)
get the enderdragon from that battle
set the phase you want
Of course you can get the enderdragon through other ways, if you for example have spawned one yourself. Also you can change the phase on whatever occasion you like.
I gave you all the links to the docs you need in my previous posts.
I understand what to do and how to do it. I just can't figure out how to change the state without getting an error
This is how i'm doing it:
Like what am I doing wrong here?
You just write out the enum, nothing else.
Here's some more detailed pseudo code...
Enderdragon dragon = ...//told you how to get it
dragon.setPhase(/*the enum phase you want*/)
Thanks this was my only problem. Have a good day
These are things you shouldn't have to struggle with. Everything is documented, just search terms like "Enderdragon" or "setPhase" in the docs and read the explanations.
Anyway, glad you got it working.