ezterry / DefaultWorldGenerator-port

Change the Default World Generator in single player minecraft
MIT License
3 stars 3 forks source link

Can an Initial command only run once? #8

Closed nmarshall23 closed 6 years ago

nmarshall23 commented 6 years ago

I'm using the Spawn Temple mod, and sometimes it leaves items from broken grass.

I would like to run a command just once to remove them.

I know I could use the scoreboard system to hack something that would run a command once. Is there an easier way?

ezterry commented 6 years ago

the commands run once per server/world start (this means when a multiplayer server starts, or a single player world loads, but before the player joins).. of course on server restart, or a player leaving/reloading the world it will re run.

In your case this re-run depending on how you filter the item being deleted could be re-run safely.. Otherwise presently I'd probably be using either a scoreboard or a tag on a hidden armor stand. (the easiest would be to use my mod to inject a mcfunction into the save file, and just call it form my mod.. since that will make writing the commands easier) .. this is if the structure is generated with the world, my command runs on the first game tick before a player joins, so if the mods trigger is the player, you may also need to implement logic (repeating mcfunction) to wait for the player to join the game.

Given the changes to commands in 1.13 I'm unlikely to add such filtering conditions to 1.12, however making it easier to have command block creations along with your modded worlds is a goal I'm striving for, even if it seems a curiosity at most for pack creators, so I'll keep things in mind in future versions.