Fishing Net Block (Update Tick Procedure)

Started by clocked_artifact on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Fishing Net Block (Update Tick Procedure)

God knows how long I've been trying to get this bit of code to work, What I'm trying to do is make a fishing net block. As far as i know, i cant add items to the fishing loot table sothats why im making it. What i want it to do is every second it chooses a number between 0-1, and if it chooses 1, an item from its loot table gets put in the fishing net blocks inventory. As of now the only thing in its loot table is just fish.code

Joined Jul 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I don't know if I can…
Sun, 11/08/2020 - 09:58

I don't know if I can explain it properly in English. But. The generated random number will never equal to 1 because on the right side there is a open interval (1). So the generated random number is: 0 <= number < 1.

interval

Also I think you will have problem with the infinity loop you made. It means if the procedure is trigerred, do infinity times putting a fish in the net. This repeat block gives sense only when you want to do the task x times when procedure is trigerred.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it took me a while to get it…
Sun, 11/08/2020 - 11:03

it took me a while to get it But I removed the repeat block and just stuck the blocks of code from inside it and just stuck that as the do function. And I changed the equal sign to a less than or equal sign. I've actually got results! I placed the block in water and when i opened it i got a fish! right now it's only limited to one slot and only one fish but i know what i need to do and my code looks like this now. Thank you for your help!

https://imgur.com/a/dxS7Pyb

Joined Jul 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You're welcome.  I just have…
Sun, 11/08/2020 - 12:15

You're welcome. 

I just have one more remark:

Now the fish is "caught" in the net in 100% cases. The "random number" block generates not just 0 and 1 but also decimal numbers between them (0,456; 0,567; etc.). Because you set the number less or equal than 1 and these are all generated numbers. So if you want to make some probability (30%; 20%; etc.) you have to set the number smaller than 1. 

For example if you want to do it with 50% chance it would be: if random number is smaller than 0,5 then do...

I think this tutorial will explain it better than me. :D
https://www.youtube.com/watch?v=SBtTsNYiHzw