Procedure help to create a machine

Started by kylze on

Topic category: Help with modding (Java Edition)

Last seen on 05:10, 2. Mar 2020
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Procedure help to create a machine

I've made a machine called a Crusher with a simple GUI - two in, one out. I want to make a machine very similar to a furnace and would like some help on getting started with the procedures needed to do it. I'd like the first slot to only take ores (coal, iron, gold, diamond, emerald and lapis), the second slot to take any fuel item the furnace takes, and after a fair time (maybe 10 seconds) I'd like it to put two of a specific item in the output slot, and consume the item and an appropriate amount of fuel. Thank you

Last seen on 00:30, 24. Aug 2023
Joined May 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok. First off, there are…
Wed, 03/18/2020 - 06:19

Ok. First off, there are some things that may or may not disappoint you about this:

1. There really isn't a way to display a progress bar like there is in a furnace

2. Slots are either input or output, and cannot selectively choose which items can be put in them

3. You will have to manually input every fuel type and probably every "smelt-able" item as well

 

Now that that's out of the way, let's get into it.

 On your custom machine block, create a procedure that triggers every block tick (make sure your block's tick rate is set to 1- found on the second page).

  1. In the procedure, create an if statement that checks if the input slot contains a valid item (use the OR block to check for multiple items).

     

  2. Then, inside the if statement, check for a valid fuel item in the other input slot using the same method (slots are numbered in the order you created them in the GUI, starting from 0 as the first slot, 1 for the second, etc.)

     

  3. Inside that if statement, put a custom NBT number value block that increases by 1. Name it "cookTime" or something like that (NBT blocks are located in the Blocks tab in the procedure menu. They're colored blue and contain a text field and a number field). This will create our timer when smelting items.

     

  4. Outside of everything else, create another if statement that checks if "cookTime", or whatever you decided to call it, is >= (greater than or equal to) a number of your choosing (this will be the time it takes to smelt one item, in ticks. 20 ticks is 1 second).

     

  5. Inside the if statement you just created, put a block that sets the "cookTime" value to 0 to reset the timer. Now, here comes the fun part

     

  6. In the same if statement, under the block you placed in the last step, create another if statement that checks the item in the "material" input slot (ie where you put the lapis). In that if statement create another if statement that checks if the output matches the result of your smelting recipe or is empty, to prevent deleting items if you don't take them out after they're done. In THAT one put a block that puts the "processed" version of the item in the output slot, as well as blocks that remove an appropriate amount of fuel and "raw" items from the input slots.

     

  7. Repeat step 6 for all items you want to process, putting the if statements one after the other.

 

Example Image: in my example, a red mushroom cooks into a mushroom block and 3 brown mushrooms cook into a dispenser.

Last seen on 14:18, 16. Apr 2024
Joined Apr 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
actually there is a way to…
Thu, 03/26/2020 - 16:35

actually there is a way to make a progress bar