Started by
KangoMPK
on
Topic category: Help with Minecraft modding (Java Edition)
I'm making a weapons mod for a small modpack. A javelin is a ranged weapon that can also do melee damage.
Is there any way to increase the reach of the melee damage(For example if you can only hit a zombie from 2 blocks away, with a javelin you can damage a zombie from 3 blocks away). please help
Not sure if it works or not but can you do something like
1. Check main hand = Javelin
2. Player attacks = Damage entity ( 3 ) blocks in front of player
use /attribute command with the run command as player procedure block.
Hi,
if you use the hand/player tick event, you can check for the reason (tag, specific, item, other) to change the base of the chosen attribute (like entity_reach (default 3)) and use a "wait" to check after a time if the reason which gives the attribute is still active (like 1s).
here is an example based on my puzzle
[Event] item in hand Tick:
IF not [get base attribute "Entity Reach" from [event/entity] = 5] #1
Do [set base value "Entity Reach to 5] for [event/entity]
Else: [wait 20 tick (1s)]
IF [get base attribute "Entity Reach" from [event/entity] = 5] and not [MainHandItem] = [Axe] or [Sword]
Do [set base value "Entity Reach to 3] for [event/entity]
All this will check if the item is in the main hand (not the other hand because it involves hitting. For "Block Reach" I would check both hands.)
If the item is the correct one and the entity has a reach other than 5 (the desired value here) it will become 5.
if the entity has reach 5, (after having activated effect 1) the game waits 1s to check if the items which allow the addition of reach are still in the hand, and if this is not the case it goes back down to 3 the reach of the entity.
hoping this helps.
#1: if you use player tick or other you need to check items in hand with this
like this: [get base attribute "Entity Reach" from [event/entity] = 5] and [MainHandItem] = [Axe] or [Sword]
Here a Link to see my puzzle
(the second part car work with player tick and other (can use tag etc...))
https://imgur.com/a/aSATHYG