Calling a procedure on a block from a procedure on an item.

Started by StellaeLux on

Topic category: Help with MCreator software

Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Calling a procedure on a block from a procedure on an item.
Mon, 08/26/2019 - 14:30 (edited)

What I want to make is: An item that when you right click displays a text message giving you information about that block.

 

The obvious way is to go to the item and adding: "If block at x y z = (blocktype) do send message to provided entity..."

However, to me it'd seem inefficient having to go through all the if/elseif statements until its the block that matches.

 

So what I wanted to do instead is having the item (on right click procedure call) use something similar to the block procedure: update/notify block at xyz.

Then upon being called, that block specifically would include the message about that block, rather that having to stuff all information about all blocks in a single item.

However, as far as I know what I tried to do here doesn't work. So what I wonder is: Is it possible to have a custom procedure be the external call for another procedure?

 

---

Example of what I mean:

Item_1: 

Call procedure named X for block at x y z. 

(Item_1 gets triggered by right-click)

 

Whatever block happens to be at x y z:

Send message to provided entity, create text with "the harvest level of this block is", get block harvest level at xyz.

(Whatever block gets triggered by external call from Item_1)

---

(I know it is possible to use: if item in entity's hand == (itemname) send message ( triggered by block right click)

Edited by StellaeLux on Mon, 08/26/2019 - 14:30
Last seen on 20:25, 8. May 2020
Joined Aug 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
"Call procedure X" requires…
Mon, 08/26/2019 - 16:42

"Call procedure X" requires you to pick a specific procedure.

What I want is to sort of have a standard procedure added to the base class of blocks, but the variables for each type of block would be different.

For example, part of every block base class would be:

if player right clicks on this block and is holding (name of specific item) > display (x) string.

 

With every different block type a specific messages has to be entered inside of the procedure, as if the block class now takes more arguments.

If you could call "notify" or something, which is a procedure that simply runs the code inside it once and can do so for each individual item in the game, then you could create a local notify functions local to a specific block/item which wouldn't be the same as the notify function inside of a different type of block.

Is there a way to do something like this through procedures?

 

 

I see what you mean, but the…
Mon, 08/26/2019 - 17:22

I see what you mean, but the only way to do this is by checking the block at and displaying the message. Minecraft does not have a notify logic. In fact, it has one (like the way BUD blocks work), but you can not pass data in this block notification event.

Last seen on 07:01, 16. Mar 2022
Joined Mar 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
  One question, how can I…
Thu, 12/12/2019 - 07:03

 

One question, how can I ask to create pets that defend me, tell me or stay still?