Started by TheGuyfromPluto on Sun, 04/12/2020 - 04:48
Topic category: User side tutorials
I want to make a mod where if you beat the Ender Dragon it spawns 4 different ores through out the world, I want it to be like Cobalt, Mythril, and Adamantite in Terraria.
I tried using Global Variable's to detect when the Ender Dragon is killed and that part worked, but i don't know the best way to make the ores spawn. I tried making the ores replace fake stone blocks i made and it looked like it worked but when you Right clicked or started mining it would turn back into the fake stone.
does anyone know how to fix this?
Edited by TheGuyfromPluto on Sun, 04/12/2020 - 06:38
I do not know. I wonder the same thing
You could make a ore with a "when block added" procedure which checks if the variable is true; if it isn't, it replaces itself with stone.
This way you would have to explore new chunks to find the ore though. You could alternatively make that when started to be mined, the ore turns into stone if the variable is false
when blocks added trigger does not work due to lag prevention mechanics;
try the let block tick randomly option instead.
But last time it worked... Was it changed in the last update of MCreator?
I think so.
It doesn't work for me :(
the random block tick makes the fake blocks i described in my first post
This is a lazy option but you could make the dragon drop a pickaxe that is strong enough to mine those ores.
This is probably not the best way to implement this but this is how I would do it:
1.Make it so when a barrier is passed (The barrier being the dragon) A global bool value is set to true.
2.Now add your ores and make sure they tick at at least once per second.
3.Add a procedure to your ores when they tick checking wether any of the blocks next to it are air, if one is air then check wether the barrier is passed. If the barrier is passed nothing happens but if has not been then the ore turns to stone, netherack or end stone depending where it is.
The reason this method is better than others is because you don't need to generate new chunks as the ores are there, but to be able to find them you need to pass your barrier.
In latest update conditions are now a thing. This problem is solved by them!
Make a 'fake stone' block, completely separate, that when mined will drop cobble, or if with silk touch will drop stone (like normal stone, duh). Have it on tick, check if the global variable is true. If it is, remove the block and place your ore!
how do i make a barrier like the one you are talking about?
Well you want to make a global variable, you can do this in the variables tab (Below mod elements and resources but above Localization and remote workspaces), add a variable, name it whatever you want, make it logical and I think the global map would be the appropriate scope.
Create a procedure, inside of the procedure set the procedure trigger to be on entity dies, check if the entity is whatever mob (this case an ender dragon) inside the IF statement set the global bool variable to true.
Now for the ore, in triggers, you can use "when neighbouring block changes" and create a new procedure that checks the variable, if false then set the block to stone/netherack/endstone.
Boom your done!
That is my method but I do believe 'Sir_sassypants' method would be better.
So you would have two blocks the first generating, has all the same properties as stone, it's in the game name being stone etc, but when it randomly ticks it checks to the global variable to see if it's true and if so switches its block for the ore.
Beyond these instructions, I'm not going to provide any screenshots mainly because well... Part of learning is figuring stuff out on your own. I also can't be bothered figuring out how to put pictures in these comments again lmao, something like Imgur.