NBT Delay not working?

Started by JustHaven on Sat, 07/23/2022 - 16:30

Topic category: Help with modding (Java Edition)

Last seen on 22:19, 23. Jul 2022
Joined Jul 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
NBT Delay not working?
Sat, 07/23/2022 - 16:30

I have seen many posts about NBT delays, but none of them help me correctly because I'm trying to do this with a potion instead of a block. Basically, I have two potion effects. When you drink the potion for the first one, it'll show a screen overlay and a couple side effects like slowness. After a specified time, it'll remove the potion effect along with the side effects and give you the second potion effect. Here's the code:

if (Get (Event/target entity) data number NBT tag "timer") =/= 5000 do {
   repeat (5000) times do {
      (Set (Event/target entity) data number NBT tag "timer") to (Get (Event/target entity) data number NBT tag "timer") - 1
}
else if (Get (Event/target entity) data number NBT tag "timer") == 5000 do {
   Clear all potion effects of (Event/target entity)
   Add potion with level (1) for (99999) ticks ambient (true) particles (false) to (Event/target entity) type: (CUSTOM:Pot2)
)

{That's not the exact code, that is all in blocks. The typed code is probably much different. I'm just very neat and formatted itΒ likeΒ code. Anyways..)

Of course, I change the 5000 with higher and lower values, however the delay is never longer than a millisecond. I also get these errors:

Block entity_nbt_num_get is not synced between client and server automatically, which means it may not work properly in some cases.
Block entity_nbt_num_get is not synced between client and server automatically, which means it may not work properly in some cases.
Block entity_nbt_num_set is not synced between client and server automatically, which means it may not work properly in some cases.
Block entity_nbt_num_get is not synced between client and server automatically, which means it may not work properly in some cases.

I've seen in one post that these warnings can just be ignored, but I thought it'd be best to include those as well.

Basically, I want the delay to be 5 seconds long, not 1 millisecond. Can someone help?

Last seen on 11:41, 19. Aug 2022
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Man, if ypu want the delay…
Tue, 08/09/2022 - 15:53

Man, if ypu want the delay to be 5 seconds the time in ticks are 100 ticks (1s = 20ticks).

I also have a similar problem that my number nbt tag is not detected