Started by
QB
on
Topic category: Help with Minecraft modding (Java Edition)
The title of this forum is kinda self-explanatory. Is there a way to make certain types of mobs weak to a certain type of weapons? Is this possible? Thanks a lot!
This is absolutely possible since I have no idea what you want. In the code I provide for you I am making giving an entity more damage.
50 is A LOT if you couldn't guess. Also if you play around with the code, don't use a projectile as the damage source, otherwise, you will loop the code and crash. You will obviously change, "YourMob" to your mob. But otherwise, the principle is the same. You can do the opposite (make your entity strong) by simply healing the entity or canceling the event. If you want that let me know. Good luck 😁.
Thanks for the quick reply, but how can I apply the code you've sent me to the weapon? Sorry, because I know nothing about custom coding without the help of Mcreator :(
Ya no problem, I believe that MCreator registers all of their classes to an event bus. Can you send over all of your code?
The codes of the weapons I made? If so they are not finished yet, can I send over once the codes and the weapons are finished? It will take a while, but I'll send you when they are finished
Do you want the entities to be weak to your sword? Because this code only works for projectiles unless we specify it for your sword.
Basically, what do you want your mob to be weak to?
Well, I wanted the mobs to be weak to silver(my custom ore) melee weapons so is there anything that needs to change?
Yes, some things need to change. But this also allows us to do some really cool things.
So here is something simple (if the player used a diamond sword),
Or alternatively, we can make so the mob is weak to all of your weapons,
We can do some other things but this is a start.
I'm messing around a bit with Mcreator, I was wondering if this would work
https://imgur.com/1CxXBBd
So how can I apply this to Mcreator? If you don't mind, can you also screenshot the procedure with Mcreator procedure blocks? Because I really really sorry but tbh I don't understand T_T
Well, I don't know if MCreator even has a LivingDamageEvent. But you can just put that code in your mob class. For an MCreator procedure, I will check and get back to you.
And no, your procedure will not work for these reasons;
1. You're not calling an event. You need this procedure to execute when a mob gets damaged.
2. There are not enough conditions, even if you had the procedure to execute correctly. You are not checking for the DamageSource, therefore, all sources (fall damage, projectiles, anvils, cactus, etc.) will kill your entity.
3. I have no clue what "Current entity" is referring to.
Thank you very much! Man, you don't know how much I appreciated you. I'll definitely credit you on my mod's page, it doesn't matter if the procedure works or not, but I'll credit you because you are very open when it comes to helping others. Again, thank you so much!
No problem, that code works (I tested it). So if you have any issues let me know and we will fix it😁.
A simple way using MCreator's block code would be to
a. Make a procedure for attacks that have an if statement for the entity and make it deal damage
b. A, but with potion effects instead
c. A, but amplified by an enchantment