• check_circle Functions
  • 1,382 views, 5 today
  • 40 downloads, 0 today
  • 8
  • 6
  • 19
Knamf's Avatar Knamf
Level 9 : Apprentice Miner
1
Streetlamps

With this datapack you can easily build street lamps that turn on automatically at night.
Like a daylight sensor but better.



How to build a street lamp
  1. Type "/function streetlamp:creator" or if no chats are allowed enter "/trigger streetlamp"
  2. Place it over a redstone lamp


  Important to know for servers and map markers


  The command "/trigger streetlamp" can be executed by any player on the map.
  To prevent this, it can be changed with the command "/function streetlamp:permission".
  The function is on by default.


  To use it in a server with multiple worlds you need to make some changes.

  Here is an explanation
  1. Go to “datapacks\streetlamp\data\streetlamp\functions”

  2. Open secondaryworlds.mcfunction with a text editor

  3. Copy the script block as many times as you own worlds. An exception is the main world in which the data package is executed including the nether and the end. This should not be entered here.
    Scrip block

    ###WORLD 1###
    #execute in minecraft:WORLDNAME store result score #time time run time query daytime
    #execute if score #time time matches 12041.. run execute if score #time time matches ..23960 run execute at @e[​type=minecraft:armor_stand,name=StreetLamp,tag=StreetLamp] if dimension minecraft:WORLDNAME run setblock ~ ~ ~ minecraft:redstone_lamp[​lit=true]
    #execute if score #time time matches 23961.. run execute at @e[​type=minecraft:armor_stand,name=StreetLamp,tag=StreetLamp] if dimension minecraft:WORLDNAME run setblock ~ ~ ~ minecraft:redstone_lamp[​lit=false]
    #execute if score #time time matches ..12040 run execute at @e[​type=minecraft:armor_stand,name=StreetLamp,tag=StreetLamp] if dimension minecraft:WORLDNAME run setblock ~ ~ ~ minecraft:redstone_lamp[​lit=false]

  4. Then change “WORLDNAME” for each script block to your world name. It is located once per line.

  5. Then remove the # in front of each line

CompatibilityMinecraft 1.18
toMinecraft 1.20
Tags

2 Update Logs

Update #3 : by Knamf 02/23/2024 9:16:49 amFeb 23rd

Can now be used in multiple worlds on one server.See the description to learn how to adjust the code
LOAD MORE LOGS

Create an account or sign in to comment.

1
02/10/2024 5:10 amhistory
Level 58 : Grandmaster Ranger
Peppe73
Peppe73's Avatar
Hi, recently there is a problem with the package, practically all the restone lamps are connected to each other, even in the different worlds, if in world A and day and in world B and night the lamps of world B remain off

maybe in MC 1.20.4 there are some changes?
1
10/13/2023 1:25 pmhistory
Level 58 : Grandmaster Ranger
Peppe73
Peppe73's Avatar
I solved it, but I noticed one thing, the on and off times changed ?? during the day they turn off when the sun is already almost high, and they turn on when it has already been dark for a while.
1
10/14/2023 1:44 pm
Level 9 : Apprentice Miner
Knamf
Knamf's Avatar
That was always so. I can adjust it to the time like the daylight sensor.
1
10/14/2023 3:13 pmhistory
Level 58 : Grandmaster Ranger
Peppe73
Peppe73's Avatar
Yes, that would be great.

Your package is very convenient, I replaced the light sensors which are so unsightly that they overlook any lamp, and made my city more realistic ;)
1
10/16/2023 9:11 am
Level 9 : Apprentice Miner
Knamf
Knamf's Avatar
I have now adapted it and tested it. It works like the daylight sensor. You also now get better feedback when you create a lamp.



Simply download new version and replace. Reload the server and you're done.
1
10/16/2023 3:07 pm
Level 58 : Grandmaster Ranger
Peppe73
Peppe73's Avatar
You're great, I put your references on my page ;)
1
09/27/2023 3:57 pmhistory
Level 58 : Grandmaster Ranger
Peppe73
Peppe73's Avatar
Hi, I'm trying your data package, because in the survival world it doesn't work, and in the creative world it does?

I would like to understand if it is a functionality problem with the package I have on my server, but I think with the package.
1
10/12/2023 9:01 am
Level 9 : Apprentice Miner
Knamf
Knamf's Avatar
Cheats must be allowed in the world. So that you can create it.
1
10/12/2023 11:05 am
Level 58 : Grandmaster Ranger
Peppe73
Peppe73's Avatar
And can't you create the package that also works in the survival world without using cheats? mine is a public server I can't activate cheats
1
10/12/2023 4:45 pm
Level 9 : Apprentice Miner
Knamf
Knamf's Avatar
So I did an update. Just load it in and reload the server.

Any player can now create a lamp using the “/trigger streetlamp” command. If you're loading it in a world with cheats, you can change this function with "/function streetlamp:permission".
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome