Cooldown on milking an entity

Started by Esjitu on

Topic category: Help with modding (Java Edition)

Last seen on 20:58, 5. May 2022
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Cooldown on milking an entity

Hello, pretty new to MCreator and using it to make a simple food/recipe expansion for my modpack. Right now I am trying to figure out how to milk a sheep and get sheep's milk. This is my procedure:

milk procedure

And it works just fine, but the thing is I can sit there with a full stack of buckets and milk the sheep infinitely. I'd like it to work like milking a cow, where if you try to milk them again right away you don't get any milk, and then after a while you can milk them again. I tried adding a cooldown to the empty bucket but A) I was still able to keep milking the sheep and B) I'd rather not disable you from using an empty bucket completely anyway, just make it so you can't milk the same sheep forever. Like if you had 3 sheep and one was on cooldown you could still milk a different one. Is there a way to do this that someone could walk me through?

Last seen on 09:57, 10. Aug 2023
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe when you milk the…
Wed, 04/27/2022 - 10:45

Maybe when you milk the sheep use NBT number tag 'cooldown' or another name to set time by ticks and it will decrease 1 per tick using the event trigger (on entity update tick) that runs on all entity's on every tick then check if it's a sheep entity the it will decrease 1 tick if the NBT number tag is higher than zero (if get number NBT tag data >0 then -1) so when you right click sheep it will check if the NBT tag is equal or lower to zero or the lowest number you chosed if true it will milk and restart the timer! The NBT tag block are is entity data and manager

Last seen on 16:57, 17. Apr 2024
Joined Dec 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
just use the cooldown…
Wed, 04/27/2022 - 15:02

just use the cooldown procedure, set the cooldown to how many seconds you want, (20 ticks = 1 second) set the given item to milk.

NBTs solution is oldschool,…
Fri, 05/13/2022 - 10:01

NBTs solution is oldschool, but kinda tough for performance-heavy (+ not sure if it's possible to do it right with non-our-mod-entities).

If Jguy cooldown works, that's a one way, but if you'd like to have another way (or cooldown doesn't work), then you can also apply potion effect after milking which would be later a condition for milking (if not under this potion -> you can milk). There's quite a lot of way how to handle that ^^

Last seen on 20:38, 3. Apr 2024
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
IMO NBT is probably your…
Fri, 05/13/2022 - 22:26

IMO NBT is probably your best bet since you want to be able to milk different sheep at the same time.

Here is how I would set it up

 

I used Swing main hand as to let the player know that something has happened when right clicking the sheep.

also just for clarity, you don't have to use the IF LOGIC = True block, when you place them like I did its basically asking the same question. But it is entirely up to you, they just do the same thing basically.

Help