Started by
FireW01
on
Topic category: Help with Minecraft modding (Java Edition)
So basically the inbuilt ranged item feature is very basic and doesn't allow for much customization, what i wanted to do was create a musket it would be an item that stores one ammo similar to a crossbow and then fires it again similar to a crossbow however nothing I've tried has worked so far and any tutorials or forums are outdated. If anyone could please help explain how i could do this that would be great
The default projectile feature isn't very good, for my ranged items I use procedures. Make a item trigger "when player finishes using item", the in that trigger go to the "projectiles" tab in the procedure, there is a block there that allows you to fire a projectile, keep in mind some of the projectiles settings will be overridden by this procedure. But there you can select its speed, power, damage, ect. As for the ammo, you will need to use item states for the best effect. One state for unloaded, one state for loaded. Then make the "finishes using item" trigger check for the item state, if unloaded and the player has ammo in their inventory take 1 ammo and set the item state to charged. If loaded, fire the projectile and set the state to unloaded. You can also set the item on cooldown after that and check if the item is on said cooldown at the beginning of your loading and firing procedure.
thanks for the help :)
ya i have a follow up question how do i check the item states? i see plenty of things for blockstates but items states i can find nothing?
ok so im using a custom global variable and swapping that and so i could technically get this working but my current problem is not allowing the player to just hold rclick to immediately fire after charging similar to a vanilla crossbow how it doesn't insta fire after charging despite you holding rclick you have to let go and press it again. will post update if i figure it out
ive done it a basic crossbow functionality for an item. How i did it
(rclick open image in new tab first image),
firstly create the item DO NOT set the item to a ranged item, in its properties set the use duration to something greater than 0 this is how many ticks it will take to charge your crossbow. Create two variable both of which are logic variables on Global_Map. first make a load_state variable which will detect whether or not the crossbow is loaded, then the second variable is using_crossbow which will detect if your holding rclick. the first procedure is player finish using item. this is the code to put in that procedure
the second procedure you need is when right clicked the code for that is the second image, and the 3rd and final procedure is on player stopped using, the code for that is the 3rd image. I hope this helped someone