Started by
Taras Ogurtsov
on
Topic category: Help with Minecraft modding (Java Edition)
Can anyone tell me how to make an achievement like "Sniper Duel", so that the player gets it when hitting a block from a certain distance?
Topic category: Help with Minecraft modding (Java Edition)
Can anyone tell me how to make an achievement like "Sniper Duel", so that the player gets it when hitting a block from a certain distance?
I understand that you use on hit block trigger in ranged item.
Can you go to folder
entity
and copy code from file@NAMEEntity.java
and use pastebin to show what's in there? I want to check how mcreator generated it when your procedure is picked.@NAME
is your ranged item name.Maybe we're talking about different things. I am using the procedure for on block hit by projectile, there is no new ranged item in my mod. Even if there is, could you explain in more detail where exactly this entity folder is? I'm sorry if I'm boring you already
Oh, you have a block mod element. In that case, trigger you are using doesn't directly give a shooter, but you are able to get shooter with a code snippet, use this line and save shooter with a local variable with type entity:
((Projectile) entity).getOwner();
Code snippet should be in advanced section.
Remember to check if it returned entity that is not null before doing anything, cause mcreator won't do this automatically, since its not in provided dependencies.
I did everything like you said except the last one. How exactly check if it returned?
In one of sections (if i remember right its in advanced) there's block with "null". Check if your entity variable doesn't equal null.
I'm probably too dumb, but I can't figure out what I'm doing wrong. Could you take a look at the screenshot of that procedure and tell me what I did wrong?
Here how it should look like:
I was wrong aboul
null
, it turns out itsno entity
instead.Also I made useless
ent
variable, we dont use it but we need mcreator to provideevent/target entity
from depencencies.Yeah, it's working, just the way it should. Thanks man, I really appreciate it! Thank you so much :)