Started by
junevolerkes
on
Topic category: Help with Minecraft modding (Java Edition)
Hello! I have been trying to create a mob that could both do melee and ranged attacks, probably depending on how far the attack target is. However, as I have been trying to accomplish that(without coding and only using the interface), the entity could only do one kind of attack, even though I had both ranged attack checked and the “do melee attack” block. Is there any way to get my mob doing both without really getting into coding? Or if not, could you please help me out with the code, I am quite new to this huge world of modding. Thank you in advance!
Edited by junevolerkes on Sat, 06/13/2020 - 06:45
i've been trying to do the same. seems minecraft will only do one of the two if you don't override any of the vanilla AI
Do you know how is that done?
not without coding
I think I am willing to try to code it, do you know how to do it(both attack types) and where to start? Thank you!
Nice Rinnegan by the way! :)
the rinnegan in my mod is even better!
how much java experience do you have?
I mean, you could create an entity with the model and texture of the projectile and set its movement to turn it into a projectile and make the mob spawn this entity, in the first version of the mod I recently launched I did this and works pretty well
That's pretty smart, actually, thank you!
1. How can I look up your mod? when I click on your profile there is only forum topics.
2. Almost zero experience with Java, I have only figured out how to make hands for armor functional by imitating the code above there, so zero and a half if you will.
oh, i haven't uploaded my mod. it is a personal mod i made with my son, with naruto and DC comics elements and my son in the mod haha. the reason i didn't upload it is bcuz we superimposed my son's face on a giant entity.
do you have any C/C++/C# experience? i haven't written any java code in my life when i started making mods last december, but you pick it up pretty quick if you have C experience.
so the easiest way is to slightly modify the code to add some checks when to execute the ranged attack AI and/or when to execute the melee AI, for example checking distance from target. in that scenario though, your mob will never try to move towards the attack target if the ranged AI is executing.
another way to do it is make your entity just do melee, and on update tick procedure add code to periodically spawn an entity that flies toward the target (like what @msrodrigues2000 suggested). this involves more coding though.
Linear movement is pretty simple, in my mod I did parabolic movement which took me more time, but since mcreator supports a lot of math you can create any movement you like for the entity-projectile. On entity tick also you can verify if player is near or not to perform the ranged attack
Hi i've also been trying to do this but I don't actually know how, the best I could do so far was lag my game with projectiles a milion projectiles with no AI, and they don't even deal damage, I tried several different procedures but I couldn't do it, i have a screenshot of what basically happened after I tried
yeah i basically made a replica of the trident model and used its textures, but it still doesn't work like one
wait im dumb why didnt i just summon a trident normally