Topic category: Help with Minecraft modding (Java Edition)
basically, I wanted to make a laser beam that fires in a straight direction (quite needless to say lol), damaging mobs that collide with it. so far, I've already set up the way to damage entities (using a lot of raytracing and "for each entity" procedures), and it was a success! (although I think the entire procedure I made is not too optimal). for the visible beam, I've been using the raytrace blocks and spawning particles of choice (I tried using a lot of spawn particle procedures to try and produce a ray directed towards the direction the player's looking at), but the problem is that the particles ended up looking unorganized, thus making it not even look like a beam at all! I wonder if making an accurate-looking ray is possible within the limitations of MCreator. is it? :/
EDIT 3/5/2021: a solution for particle-based beams has been found! (thanks for the help!) now I just need to know how to make beacon-like rays, if possible
you could try shooting the particles at that direction instead of creating no motion particles in the path of the beam.
Giving the particles motion is what I did to make the lasers on my claymore mine, I would recommend doing that. I adapted this procedure in order to make the particles move in the direction the mine was facing: https://mcreator.net/forum/58735/move-direction-youre-facing
@TheCatalystGaming
I tried giving motion to the particle/s as you said (following the procedure at https://mcreator.net/forum/58735/move-direction-youre-facing & changing some parameters), but unfortunately, it didn't work for me. it just spawned the particles under the player and they didn't even move anywhere...
I might've got something wrong... but I'm not sure what. here's the procedure I made:
(I put this in my item's "When right-clicked in air" trigger, as the damage procedure was also there)
could you send a screenshot of the procedure you made to achieve a laser beam effect?
Here is the procedure I used:
https://i.imgur.com/lN3xKQx.png
Link if image doesn't show: https://imgur.com/a/0Dr3NQE
Your procedure doesn't seem much different, although it does produce some high values (That might be what you're aiming for though)
I changed the particle on one of my claymores lasers to the dragon's breath particle and it still moved, so the particle itself isn't the problem. I can't see any issues looking at it, but hopefully this will help.
1. if you want to use the player rotation, you'll need to use the player head yaw, not player yaw. use a code snippet block and put in something like "player_yaw=entity.getRotationYawHead();"
2. i think its better to use the "look x/y/z position of entity with raytrace distance n" code blocks instead of player rotation, your calculations are not correct. do something like speed x "look x/y/z position with raytrace 2" and put in vx, vy, vz. play around with the speed variable to get the speed right
it works! thank you both!
P.S. been quite a while since I last visited this forum topic. if you guys have wondered where I've been, I was recently busy working on Betterlands, and outside of that I've been coming up with a more optimized procedure to deal damage in a "straight" line (still using raytrace blocks). and I've found a working solution for the damage, which I might share on a new user-side tutorial forum topic if I have the time.
so yeah, thanks again!
also, one last thing. I originally wanted the laser beam to render either like a beacon beam, or a guardian/elder guardian's laser beam attack. might I ask if there a way to achieve either of those, and what code it takes to make?
there's*
Yeah, how can you make a beacon-like beam, something like the one in Mowzie's Mobs that the sun chief uses, or like the spiral one the guardians use?
Unfortunately I don't know how to create a beam not made of particles. Also, I would love to see a user-side tutorial about this laser beam you've made, it would help a lot of people!
it's okay, i think I'll just learn how to code one (like, if I get it right, visuals for particle-less beams use special renderers or something, perhaps I'll take a look at the MC source code and check how beacon beam works; but if i fail there, i might continue using particles as it's a good alternative too). and as for the laser beam, a tutorial is coming very soon! :)
alright, the tutorial is now up! https://mcreator.net/forum/74550/tutorial-how-create-simple-laser-beam-mcreator