Topic category: Help with Minecraft modding (Java Edition)
Hello, I'm new to modding in mcreator, but I've already learned some basic things and I'm making a mod that adds a new dimension, and the part that I'm in doubt about creating in the mod is how to access the dimension, which is by placing a block that I called "portal ejector" and around it, two blocks away from its four diagonals, I need to place four customized blocks that I called "activation pedestal" and then on each pedestal it is necessary to place an item that I called "pedestal core" and after these items are placed on the pedestals it will be necessary to place an item on the portal ejector that I called "singularity" by right-clicking on the block after all the pedestals are activated an animation of particles will occur coming out of each of the pedestals and going to the center where the portal ejector is, something similar to the mystical agriculture rituals to make items with pedestals and an altar, but unlike mystical agriculture in the center block that is the portal ejector it will do what the name says which will be to create a custom portal that is like an entity with animated texture with an animation of it opening right above the portal ejector and then after the portal is fully open the particles will disappear and the pedestals will be deactivated again without the pedestal core, but the portal will remain open there until a player gets close enough to it that he will be teleported to the dimension above another custom block that I called "exit teleport pad" which as the name says when a player right-clicks on this block in this new dimension he will return to the overworld above the portal ejector right where the portal that took him to the dimension is, but then as soon as the player returns to the overworld, the portal will do an animation closing and will disappear, making the player need to place another 4 pedestal cores on the pedestals and another singularity on the portal ejector to open the portal again. And I also want that regardless of the coordinates that the portal is made, the player will always go to the same place in the dimension that the exit teleport pad is, just like when entering the end, the player will always go to the same place on the main island. This seems a little complicated but I have already created all the blocks, items and the dimension, I just want to know how I do this procedure of creating the portal and teleporting to the dimension.
The portal creation is the easy part. The activation block will need an on right click trigger then just check the coordinate locations from x y z of the activation block. So at x+3 y z+3 etc. One for each block and check that the block at that coord is the right one. If all of those are true, spawn your portal entity at x y+2 z or wherever. To teleport use a tick event on the entity, in a 3 or whatever block radius get all entities of type player and switch dimension. Then a on entering dimension trigger, make it so the player gets teleported to whereever you want depends on the dimension type and then place structure exit teleport pad at x y z. For the opposite you need to save the coords of the initial portal when creating it, then on player right clicks exit teleport pad switch dimension to overworld and then tp player to the saved coords. Then make entity play animation etc and kill entity and remove whatever blocks you want.
I think I understand, but I don't know much about the procedures, and also how do I set the event of particles leaving the pedestals like in the mystical agriculture altar recipes?
For the procedures and portal think of it like a grid and use coordinates. For the particles I dont know, you could spawn them at the certain coordinates but I dont think it will look how you want it to. There may be a way to spawn particles bridging two points but I dont know how and it might only be possible using code.
I dont know how to make it visuallyy but theoretically you just need that central block which is your activation block to trigger all the other blocks. Either use it to change nbts of the other blocks and make them tick and spawn particles when the nbt changes. Or you can activate everything from the control block and make it spawn the particles at the set coordinates.