How do i make an item lose durability AND give a potion effect when right clicked?

Started by proxerater on

Topic category: Help with MCreator software

Joined Mar 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do i make an item lose durability AND give a potion effect when right clicked?
Sat, 10/27/2018 - 09:35 (edited)

I can't figure it out. Maybe i'm just stupid? help please!

The problem is is that i don't what to put in "while" because i only want it to do these two events. Help!

Here's the picture....

https://imgur.com/a/QtwOYAy

Edited by proxerater on Sat, 10/27/2018 - 09:35
Joined Jun 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try removing the while...
Sat, 10/27/2018 - 22:42

Try removing the while...

Joined Mar 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I had already tried that and…
Sun, 10/28/2018 - 03:57

I had already tried that and it came up with this.

https://imgur.com/a/QzV3gjc

 

In required dependencies, it says "itemstack".

Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Proxerater, I believe I have…
Sun, 10/28/2018 - 16:24

Proxerater, I believe I have a solution to your problem. I've been working on making several tools with various effects on right click. This is however a very lengthy explanation.

For explanation purposes I'm using brackets as a place holder for events: [example event], and parentheses as a place holder for user defined variables: (example variable). For sake of neatness, I use alphabetical order with my events as much as possible.

In the procedure system, you need two specific events: from the Player Management tab, grab the [Add Potion With Level (define level here) And Duration (define duration here) To Provided Player -Potion: (select potion here)]. And the other event from the Item Modifications tab, [Deal The Provided Item Damage Of Amount (specify damage dealt here)]

Once you have those in the workspace, if you're unfamiliar with the PS, you'll want to arrange the events like so below:

[Event Trigger]

[Add potion with level () and duration () to provided player - potion ()]

[Deal the provided item damage of amount ()]

I hope this helps, have a nice day/night depending on when/if you read this.

Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
This is as a post script for…
Sun, 10/28/2018 - 16:37

This is as a post script for my comment above, I realize you may not know that you need to link the new procedure to the item you want it to work with.

Open/edit the item you want the procedure linked to and when you get to the Add Procedure page, click the drop tab on When Right Clicked In Air/On Block and add your procedure to your desired option.

Personally, I advise against adding it to On Item Creation, as that will cost your item usage before you're ready to use it. I also advise against adding it to When Block Destroyed With Tool as then it's costing you extra usage each time you mine any block.

Joined Mar 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh, i know this thank you.
Sun, 10/28/2018 - 18:17

Oh, i know this thank you.

Joined Mar 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, well, thank you for the…
Sun, 10/28/2018 - 18:19

Ok, well, thank you for the help buuuuttt....

a new problem happened. It says "itemstack" in a red color. Please let me know if i did something wrong...

https://imgur.com/a/lSO1htl

Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
So, I've spent a few minutes…
Sun, 10/28/2018 - 18:40

So, I've spent a few minutes looking over your code and nothing is wrong with it, the itemstack is supposed to be in red as the color shows what type of code it is the procedure affects: blue(xyz), tan(world), green(entity), purple(block), red(item), and green(GUI/inventory).

Hope this helps

Joined Mar 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ok. So i tested it.. and...
Sun, 10/28/2018 - 21:03

ok.

So i tested it.. and...

This is the code that shows up in the console when i right click in the air AND at a block with the item in my hand.

Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Did you attempt loading the…
Sun, 10/28/2018 - 21:41

Did you attempt loading the mod in Minecraft or the sim within MCreator?

Joined Mar 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
don't know what a sim is,…
Tue, 10/30/2018 - 21:14

don't know what a sim is, but i used the mod within MCreators' minecraft launcher

Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sim is short for simulation…
Tue, 10/30/2018 - 21:23

Sim is short for simulation. The launcher in MCreator only simulates a Minecraft client, personally I prefer using Minecraft itself by exporting the mod to my Minecraft mod folder. When I tried using the client sim, my computer crashed, so I used "Test" as the mod name and put it in Minecraft. For me, the code is more stable there. While testing, I take notes on what I need to change before quiting, deleting my test mod, and fixing my code or continuing with the mod if I'm content with it.

Joined Jun 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Just remove the while/do…
Tue, 10/30/2018 - 22:01

Just remove the while/do block and just put the lose durability under the potion effect

Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I've actually done this in…
Wed, 10/31/2018 - 04:01

I've actually done this in my mod, so I can confirm the method I have used does work. Just note that Damage Durability doesn't necessarily (unless I'm doing it wrong) calculate correctly, so it is possible to obtain negative Durability. Hope this helps. The example I've given is when a Diamond Sword in your main hand has been Right-Clicked.

Example