Problems creating and removing light

Started by Дядя Хальман on Sun, 07/19/2020 - 17:41

Topic category: Help with modding (Java Edition)

Last seen on 20:06, 29. Aug 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Problems creating and removing light
Sun, 07/19/2020 - 17:46 (edited)

I made a lamp that glows in my hands, an air block that is invisible and emits light, and a procedure that destroys the block in 2 tick cycles in UpdateTick. When I check this, everything is fine, but if I run or run incline, the block of glowing air does not disappear!

Behold going forward:

https://sun1-95.userapi.com/7qHjtR2wfEtzCcf6wikm2y3blf2W1QHSib8IMg/bk5M…

Here i go askew

https://sun1-90.userapi.com/rQoH5O8BgA1ZFX_hgz1IjjTsXENp-cM5Uoi-xw/usIr…

https://sun1-47.userapi.com/A-jt18ktvvASRNTSry7tgnsV1LncF-CQGvO7RA/4i7-…

Edited by Дядя Хальман on Sun, 07/19/2020 - 17:46
Last seen on 16:45, 22. Jun 2021
Joined May 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Maybe try to add a "on block…
Sun, 07/19/2020 - 19:32

Maybe try to add a "on block tick" procedure for the air block that checks if the player is inside of it, and if not it changes itself back to normal air?

Last seen on 13:57, 2. Apr 2021
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Create a block with…
Sun, 07/19/2020 - 21:10

Create a block with invisible texture called like "lamp air" that emits your light, give it an "on block tick" remove block (make sure to not have particles).

To optimise the mod and make it less laggy you can add 1 to a local var that say "if local_var_name is =< 10 (20?) remove block else local_var_namelocal_var_name +1" Then the block will not be removed every tick but each 0,5s (or 1s).

You can make the "lamp air" block spawn on x y-1 z to make it more "realistic" because your item is in your hand, not on your head :3

(And before placing the block, check if there is air on x y-1 z or you will have problems with plants, lava and water :P

Last seen on 13:57, 2. Apr 2021
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Ok I tried and I have the…
Sun, 07/19/2020 - 21:40

Ok I tried and I have the same problem, now I see the meaning of your post, I'll work on that.

Last seen on 13:57, 2. Apr 2021
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
This is a delay/lag problem…
Sun, 07/19/2020 - 22:09

This is a delay/lag problem. The game can't calculate fast enough to remove the block at x y z because we aren't anymore on theses coordinates. You should check a 3x3 zone with "if block at x y z is lamp_air, remobe block at x y z" (and same thing with x-1, y-1, x+1, etc, etc...) then we can't miss any lamp_air block. I think there is a better optimised way to create a lamp but if you check a fairly large area it works.

Last seen on 20:06, 29. Aug 2020
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I did what you said, and I…
Mon, 07/20/2020 - 08:19

I did what you said, and I need to correct a little that you need to create not 3 by 3, but 5 by 5 or 6 by 6. Just as in this case, light blocks appear at 3 by 3, but already less often. I checked and it is better to do 5 by 5 or 6 by 6 and then everything will be fine :)

Thank)