Started by
zorualeloupsolitaire
on
Topic category: Help with Minecraft modding (Java Edition)
Hello,
I'd like to improve my mod's combat system, and for defense, I had the idea of adding an invisible enchanted shield as soon as the player presses a key, G for example (although right-clicking would be better).
This invisible shield would withdraw as soon as the player stopped pressing the button.
But I don't know how to get Mcreator to add a shield to the player's second hand.
Thanks in advance!
Helo,
You should probably have a global itemstack variable on player lifetime ex. name: off-hand-item
You could do a procedure "WhenKey(Key)Pressed" do
Set itemstack global: (off-hand-item) to (item in off-hand of (Entity))
Set item in off-hand of (Entity) to (1) (invisible shield)
And procedure "WhenKeyReleased" do
Set item in off-hand of (Entity) to (get number of items(global:(off-hand-item))) (global:(off-hand-item)))
Good evening!
I'd like to thank you for your help, but I'm having trouble understanding what you've done for the part where you release the key.
Could you go into more detail?