Item that only glows under specific conditions?

Started by Crafter1024 on Wed, 06/02/2021 - 05:57

Topic category: Help with modding (Java Edition)

Last seen on 03:54, 29. Jun 2021
Joined Feb 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Item that only glows under specific conditions?
Wed, 06/02/2021 - 05:57

I'm trying to make a book item that'll only glow under specific conditions. Specifically: In the proper biome, at or above cloud height, around midnight, with the sky visible. Reason I want those conditions specifically is cause those are the conditions you can actually use the item, and I think it glowing would be a good tell for the player to know it can be used (Main idea is that, when right clicked in the off-hand with a specific weapon in the main-hand, it'll give the weapon a special enchant only it can get and the book will be used up).

So far, my procedure is this (Doing it via text cause putting an image is kind of a hassle. Hopefully this makes sense):

No additional trigger

If: Is biome at x: x, y: y, z: z type CUSTOM:StellarMountain

AND: Get height of Event/target entity ≥ 128

AND: Can location at x: x, y: y, z: z see the sky

AND: Get current world time ≥ 17000

AND: Get current world time ≤ 19000

Do: Return true

Return false

But it glows despite not meeting any of those conditions. How do I get it to actually work the way I plan it to? Cause I was certain this would work, but it just isn't (And yes, the item glow condition is set in the item's mod element). Any help would be appreciated.

Last seen on 03:54, 29. Jun 2021
Joined Feb 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Update: Turns out it glowing…
Wed, 06/02/2021 - 06:27

Update: Turns out it glowing was just MCreator being janky and undoing my settings despite me having saved again.

But now it doesn't glow even when it does meet the conditions, so I still need help, just for the opposite issue. Lol.

Last seen on 03:54, 29. Jun 2021
Joined Feb 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Update 2: It also won't…
Wed, 06/02/2021 - 06:49

Update 2: It also won't function despite meeting the conditions. Idk what I did wrong. ;-;

Last seen on 03:54, 29. Jun 2021
Joined Feb 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Update 3: Turns out "AND:…
Wed, 06/02/2021 - 07:39

Update 3: Turns out "AND: Get height of Event/target entity ≥ 128" is what was causing it all to break, so changing it to "Get world surface height at x: x, z: z" made it function properly, but it still doesn't glow even with that bit replaced, which is really weird.

Last seen on 03:54, 29. Jun 2021
Joined Feb 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Update 4: Ok, so I made the…
Wed, 06/02/2021 - 08:11

Update 4: Ok, so I made the glowing TECHNICALLY function. The problem is that it only glows when all the conditions are met and... you're standing on a block you've smacked. What? How is that even a thing that's happening? I'm so confused. Lmao.
New procedure for reference:
 

No additional trigger

If: Is biome at x: x, y: y, z: z type CUSTOM:StellarMountain

AND: Can location at x: x, y: y, z: z see the sky

AND: Get current world time ≥ 17000

AND: Get current world time ≤ 19000

Do: If: Get World surface height at x: x, z: z ≥ 128

Do: Return true

Return false

Any ideas on what's causing this?

Last seen on 03:54, 29. Jun 2021
Joined Feb 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I really don't want to get…
Wed, 06/02/2021 - 23:55

really don't want to get rid of the glowing, cause it'd be a good QOL thing, but if it breaks like this, I might just have to. :/

Last seen on 03:54, 29. Jun 2021
Joined Feb 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
...I guess I might just have…
Sat, 06/05/2021 - 20:31

...I guess I might just have to remove it... Either that or leave it in and give a warning or something? Idk.
Thing is, I know what's breaking it. It's the height detection. But idk what alternative I could use, cause height is very important for this feature... :/

Last seen on 19:53, 28. Jul 2021
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You are using the return…
Thu, 07/08/2021 - 19:40

You are using the return block wrong (a lot of people do, don't feel bad). Rather than putting the return block inside an if statement, the return block should contain all the conditions itself, something like this:

return <condition 1> and <condition 2> and <condition 3> etc.

Last seen on 23:08, 21. Jul 2021
Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Its also doing this because…
Fri, 07/09/2021 - 00:42

Its also doing this because AND detects ONLY if both statements align

 

So it does return true is True AND True BUT it ALSO returns true is False AND False

 

Your code isn't necessarily wrong just a Logic error

 

Do them in nested IF statements instead to have it all function correctly

 

Example

 

If biome check

  • If see sky
  •  - If midnight (id keep the 2 world times in an AND statement)
  •  - - Return True

Else

  • Return False