Started by
SageMMXX
on
Topic category: Help with Minecraft modding (Java Edition)
Hi, I'm trying to make a flashlight mod for 1.19.2 (for a horror-based modpack among me and my friends) And for some reason, the light blocks it places sometimes stay instead of disappearing (like they should be) and it's driving me insane, does anyone know how to fix this? sprint jumping leaves behind a huge trail of them, and so does just flicking it around, and using it in general. I have looked at the very few tutorials there are and none have helped. (I am using projectiles to place the light blocks if that is part of the issue)
What I would do is create your own custom light block, make it have no collision and transparent texture, and under the 'when block added' trigger, use the 'wait (x) ticks on server-side' and change the number (x) to however many ticks you want the block to be there, then have it do 'remove block at x y z,' so it basically destroys itself after however many ticks. I would also keep whatever other procedures you already have to remove the blocks, just have this self destruction as a backup for when the normal removing fails.
Unfortunately, that hasn't worked, I tried it and there are still blocks remaining and I have no idea why. I mean it didn't even change much at all. however, I did notice that when you are sprint jumping most of the blocks that don't disappear are behind the player, I don't know how this has anything to do with the blocks not removing, but it might be helpful in some way.
How odd, would you be able to send a screenshot of the code that destroys the light blocks and any other code you think might be acting weird?
It's just a simple "wait 5 ticks" "remove block at X Y Z" procedure, even stranger, Since I switched to raycasts (instead of projectiles) it works fine until you hit a certain point where the blocks stop removing themselves, then the flashlight stops working a few blocks later, I have no reasonable explanation for this bug.
I gotta be honest I can’t read Java lol, but I’m wondering if it’s having an issue where it may accidentally place 2 of the light block at once causing some code to stop functioning, so maybe try instead of remove block at x y z, set block to air at x y z. Purely theoretical idea, but it might be worth a try.
use commands instead they should be easier to deal with.