I ask this because I want to make a "Zombie Infection"-esque function script to run on a Realm, but I don't want to have to worry about keeping spawn chunks loaded for the sake of a daylight sensor hooked to a command block. I will probably just find another idea if this isn't possible.
Rollback Post to RevisionRollBack
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
Here is a function I wrote to make baby zombies burn in direct sunlight:
scoreboard players tag @e[type=minecraft:zombie,tag=burn] remove burn
scoreboard players tag @e[type=minecraft:zombie] add burn {Fire:0s,IsBaby:1b}
scoreboard players tag @e[type=minecraft:zombie] add burn {Fire:-1s,IsBaby:1b}
scoreboard players set @e[tag=loopHandle] catchFire 0
stats entity @e[tag=loopHandle] set QueryResult @s catchFire
execute @e[tag=loopHandle] ~ ~ ~ time query daytime
execute @e[tag=loopHandle,score_catchFire_min=12541] ~ ~ ~ scoreboard players tag @e[tag=burn] remove burn
scoreboard players set @e[tag=burn] catchFire 0
stats entity @e[tag=burn] set SuccessCount @s catchFire
execute @e[tag=burn] ~ ~ ~ testforblocks ~ ~1.5 ~ ~ 254 ~ -211 ~1.5 211 masked
entitydata @e[tag=burn,score_catchFire_min=1] {Fire:200s}
But since you want to work with players, you will need to adjust the target selectors in the first three commands, as well as change the very last command to setblock fire at the player, since entitydata does not work on players.
The catchFire scoreboard objective is type dummy. The entity with the tag loopHandle is just an armorstand to store the result of the "time query daytime" command. You can use anything here, even a random player.
Edit: Also adjust the x and z in the last set of 3 coordinates in the second to last command. The location is not important. What is at the coordinates is not important. It just needs to be in the spawn chunks so that it is always loaded. Since we are using masked mode, it does not need to be only air blocks. We are using the blocks above the player as the source, so air blocks can be anything in the destination, but a non air block in the source must match perfectly in the destination (possible, but very, very unlikely.) This makes sure the player is in direct sun light.
Here is a function I wrote to make baby zombies burn in direct sunlight:
scoreboard players tag @e[type=minecraft:zombie,tag=burn] remove burn
scoreboard players tag @e[type=minecraft:zombie] add burn {Fire:0s,IsBaby:1b}
scoreboard players tag @e[type=minecraft:zombie] add burn {Fire:-1s,IsBaby:1b}
scoreboard players set @e[tag=loopHandle] catchFire 0
stats entity @e[tag=loopHandle] set QueryResult @s catchFire
execute @e[tag=loopHandle] ~ ~ ~ time query daytime
execute @e[tag=loopHandle,score_catchFire_min=12541] ~ ~ ~ scoreboard players tag @e[tag=burn] remove burn
scoreboard players set @e[tag=burn] catchFire 0
stats entity @e[tag=burn] set SuccessCount @s catchFire
execute @e[tag=burn] ~ ~ ~ testforblocks ~ ~1.5 ~ ~ 254 ~ -211 ~1.5 211 masked
entitydata @e[tag=burn,score_catchFire_min=1] {Fire:200s}
But since you want to work with players, you will need to adjust the target selectors in the first three commands, as well as change the very last command to setblock fire at the player, since entitydata does not work on players.
The catchFire scoreboard objective is type dummy. The entity with the tag loopHandle is just an armorstand to store the result of the "time query daytime" command. You can use anything here, even a random player.
Edit: Also adjust the x and z in the last set of 3 coordinates in the second to last command. The location is not important. What is at the coordinates is not important. It just needs to be in the spawn chunks so that it is always loaded. Since we are using masked mode, it does not need to be only air blocks. We are using the blocks above the player as the source, so air blocks can be anything in the destination, but a non air block in the source must match perfectly in the destination (possible, but very, very unlikely.) This makes sure the player is in direct sun light.
To clarify, I wanted to use a function that doesn't need anything to be in the spawn chunks for it to work...
Rollback Post to RevisionRollBack
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
Nothing needs to be in the spawn chunks. For the entity, use a random player, and the coordinates are simply coordinates. Nothing else.
But like, if you look at the official wiki the spawn chunks only stay loaded if you have a machine going in them sending items through a portal every so often, otherwise when there are no players in the Overworld they'll unload after a bit. No matter, I'm going to try a different idea since this one just seems like it'd be too much work to be realistic for my timeframes.
Rollback Post to RevisionRollBack
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
But like, if you look at the official wiki the spawn chunks only stay loaded if you have a machine going in them sending items through a portal every so often, otherwise when there are no players in the Overworld they'll unload after a bit. No matter, I'm going to try a different idea since this one just seems like it'd be too much work to be realistic for my timeframes.
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
I ask this because I want to make a "Zombie Infection"-esque function script to run on a Realm, but I don't want to have to worry about keeping spawn chunks loaded for the sake of a daylight sensor hooked to a command block. I will probably just find another idea if this isn't possible.
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
Here is a function I wrote to make baby zombies burn in direct sunlight:
But since you want to work with players, you will need to adjust the target selectors in the first three commands, as well as change the very last command to setblock fire at the player, since entitydata does not work on players.
The catchFire scoreboard objective is type dummy. The entity with the tag loopHandle is just an armorstand to store the result of the "time query daytime" command. You can use anything here, even a random player.
Edit: Also adjust the x and z in the last set of 3 coordinates in the second to last command. The location is not important. What is at the coordinates is not important. It just needs to be in the spawn chunks so that it is always loaded. Since we are using masked mode, it does not need to be only air blocks. We are using the blocks above the player as the source, so air blocks can be anything in the destination, but a non air block in the source must match perfectly in the destination (possible, but very, very unlikely.) This makes sure the player is in direct sun light.
To clarify, I wanted to use a function that doesn't need anything to be in the spawn chunks for it to work...
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
Nothing needs to be in the spawn chunks. For the entity, use a random player, and the coordinates are simply coordinates. Nothing else.
But like, if you look at the official wiki the spawn chunks only stay loaded if you have a machine going in them sending items through a portal every so often, otherwise when there are no players in the Overworld they'll unload after a bit. No matter, I'm going to try a different idea since this one just seems like it'd be too much work to be realistic for my timeframes.
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
No. The spawn chunks never unload. Ever.
Maybe in older versions they didn't. Look it up.
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.
The very first line of the wiki clearly states the difference between spawn chunks and normal chunks:
"Spawn chunks are chunks found in the world spawn point which are not unloaded from the memory, unlike normal chunks."
I was confused about the exact mechanics apparently, but read a little bit further down on that first page. Under "Other Dimensions".
I hope someday there's more magic in Minecraft, though I know it's not likely to happen. In the meantime, I play modded a lot. I enjoy a lot of other games too, so don't expect me to be on the forums all the time.