Skip to content

Commit

Permalink
Merge branch 'release/v1.1-mc18w08b'
Browse files Browse the repository at this point in the history
  • Loading branch information
xmamo committed May 23, 2018
2 parents 5e99564 + 33f50d0 commit 3365919
Show file tree
Hide file tree
Showing 20 changed files with 168 additions and 39 deletions.
2 changes: 1 addition & 1 deletion data/b7s/functions/command/getinfo.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

tellraw @s ["[Barebones] ",{"color":"yellow","text":"Barebones is an open source data pack that provides essential functionality for vanilla Minecraft servers. For more information, you can visit Barebones' website at "},{"color":"blue","underlined":true,"text":"https://github.com/xMamo/minecraft-barebones","clickEvent":{"action":"open_url","value":"https://github.com/xMamo/minecraft-barebones"},"hoverEvent":{"action":"show_text","value":"Click here to visit Barebones' website"}}]
tellraw @s ["[Barebones] ",{"color":"yellow","text":"Barebones is an open source data pack that provides essential functionality for vanilla Minecraft servers. For more information, you can visit Barebones' website at "},{"color":"blue","underlined":true,"text":"bit.ly/mcbarebones","clickEvent":{"action":"open_url","value":"https://bit.ly/mcbarebones"},"hoverEvent":{"action":"show_text","value":"Click here to visit Barebones' website"}}]
2 changes: 1 addition & 1 deletion data/b7s/functions/command/tpback.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ scoreboard players operation @s b7s._val = @s b7s.val

function b7s:entity/back/check_loc_set
execute unless score @s b7s.val matches 0 run function b7s:command/tpback/_if_set
tellraw @s[scores={b7s.val=0}] ["[Barebones] ",{"color":"red","text":"You have nowhere to teleport back"}]
execute if score @s b7s.val matches 0 run tellraw @s ["[Barebones] ",{"color":"red","text":"You have nowhere to teleport back"}]

scoreboard players operation @s b7s.val = @s b7s._val
2 changes: 1 addition & 1 deletion data/b7s/functions/command/tphome.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ scoreboard players operation @s b7s._val = @s b7s.val

function b7s:entity/home/check_loc_set
execute unless score @s b7s.val matches 0 run function b7s:command/tphome/_if_set
tellraw @s[scores={b7s.val=0}] ["[Barebones] ",{"color":"red","text":"Home not set"}]
execute if score @s b7s.val matches 0 run tellraw @s ["[Barebones] ",{"color":"red","text":"Home not set"}]

scoreboard players operation @s b7s.val = @s b7s._val
2 changes: 1 addition & 1 deletion data/b7s/functions/command/tpspawn.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ scoreboard players operation @s b7s._val = @s b7s.val

function b7s:config/spawn/check_loc_set
execute unless score @s b7s.val matches 0 run function b7s:command/tpspawn/_if_spawn_loc_set
tellraw @s[scores={b7s.val=0}] ["[Barebones] ",{"color":"red","text":"No spawn location has been set"}]
execute if score @s b7s.val matches 0 run tellraw @s ["[Barebones] ",{"color":"red","text":"No spawn location has been set"}]

scoreboard players operation @s b7s.val = @s b7s._val
4 changes: 2 additions & 2 deletions data/b7s/functions/config/back/set_persist.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# /scoreboard players set @s b7s.val (0|1)
# /function b7s:config/back/set_persist

scoreboard players set #b7s.persist_back b7s.val 0
execute unless score @s b7s.val matches 0 run scoreboard players set #b7s.persist_back b7s.val 1
execute if score @s b7s.val matches -2147483648.. if score @s b7s.val matches 0 run scoreboard players set #b7s.persist_back b7s.val 0
execute if score @s b7s.val matches -2147483648.. unless score @s b7s.val matches 0 run scoreboard players set #b7s.persist_back b7s.val 1
4 changes: 2 additions & 2 deletions data/b7s/functions/config/back/set_save_as_tags.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# /scoreboard players set @s b7s.val (0|1)
# /function b7s:config/back/set_save_as_tags

scoreboard players set #b7s.save_back_as_tags b7s.val 0
execute unless score @s b7s.val matches 0 run scoreboard players set #b7s.save_back_as_tags b7s.val 1
execute if score @s b7s.val matches -2147483648.. if score @s b7s.val matches 0 run scoreboard players set #b7s.save_back_as_tags b7s.val 0
execute if score @s b7s.val matches -2147483648.. unless score @s b7s.val matches 0 run scoreboard players set #b7s.save_back_as_tags b7s.val 1
4 changes: 2 additions & 2 deletions data/b7s/functions/config/home/set_save_as_tags.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# /scoreboard players set @s b7s.val (0|1)
# /function b7s:config/home/set_save_as_tags

scoreboard players set #b7s.save_home_as_tags b7s.val 0
execute unless score @s b7s.val matches 0 run scoreboard players set #b7s.save_home_as_tags b7s.val 1
execute if score @s b7s.val matches -2147483648.. if score @s b7s.val matches 0 run scoreboard players set #b7s.save_home_as_tags b7s.val 0
execute if score @s b7s.val matches -2147483648.. unless score @s b7s.val matches 0 run scoreboard players set #b7s.save_home_as_tags b7s.val 1
14 changes: 14 additions & 0 deletions data/b7s/functions/config/multiplayer_bed/get_enabled.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Checks whether to enable multiplayer bed functionality.
#
# Scores set:
# b7s.val - to 1 if multiplayer bed functionality is enabled, 0 otherwise
#
# Usage:
# /function b7s:config/multiplayer_bed/get_enabled

scoreboard players set @s b7s.val 0
execute unless score #b7s.multiplayer_bed b7s.val matches 0 run scoreboard players set @s b7s.val 1
18 changes: 18 additions & 0 deletions data/b7s/functions/config/multiplayer_bed/set_enabled.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Enables or disables multiplayer bed functionality. If this functionality is
# enabled, only one player is required to sleep to make the night pass.
# By default, this behaviour is disabled.
#
# Scores set:
# b7s.val - to 1 if multiplayer bed functionality is enabled, 0 otherwise
#
# Usage:
# /function b7s:config/multiplayer_bed/set_enabled

scoreboard players set #b7s.multiplayer_bed b7s.val 0

execute if score @s b7s.val matches -2147483648.. if score @s b7s.val matches 0 run scoreboard players set #b7s.multiplayer_bed b7s.val 0
execute if score @s b7s.val matches -2147483648.. unless score @s b7s.val matches 0 run scoreboard players set #b7s.multiplayer_bed b7s.val 1
12 changes: 6 additions & 6 deletions data/b7s/functions/config/spawn/set_loc.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
# /scoreboard players set @s b7s.rot_y <rot_y>
# /function b7s:config/spawn/set_loc

scoreboard players operation #b7s.spawn b7s.dim = @s[scores={b7s.dim=-2147483648..}] b7s.dim
scoreboard players operation #b7s.spawn b7s.x = @s[scores={b7s.x=-2147483648..}] b7s.x
scoreboard players operation #b7s.spawn b7s.y = @s[scores={b7s.y=-2147483648..}] b7s.y
scoreboard players operation #b7s.spawn b7s.z = @s[scores={b7s.z=-2147483648..}] b7s.z
scoreboard players operation #b7s.spawn b7s.rot_x = @s[scores={b7s.rot_x=-2147483648..}] b7s.rot_x
scoreboard players operation #b7s.spawn b7s.rot_y = @s[scores={b7s.rot_y=-2147483648..}] b7s.rot_y
execute if score @s b7s.dim matches -2147483648.. run scoreboard players operation #b7s.spawn b7s.dim = @s b7s.dim
execute if score @s b7s.x matches -2147483648.. run scoreboard players operation #b7s.spawn b7s.x = @s b7s.x
execute if score @s b7s.y matches -2147483648.. run scoreboard players operation #b7s.spawn b7s.y = @s b7s.y
execute if score @s b7s.z matches -2147483648.. run scoreboard players operation #b7s.spawn b7s.z = @s b7s.z
execute if score @s b7s.rot_x matches -2147483648.. run scoreboard players operation #b7s.spawn b7s.rot_x = @s b7s.rot_x
execute if score @s b7s.rot_y matches -2147483648.. run scoreboard players operation #b7s.spawn b7s.rot_y = @s b7s.rot_y
4 changes: 2 additions & 2 deletions data/b7s/functions/config/tp_req/set_persist.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# /scoreboard players set @s b7s.val (0|1)
# /function b7s:config/tp_req/set_persist

scoreboard players set #b7s.persist_tpreq b7s.val 0
execute unless score @s b7s.val matches 0 run scoreboard players set #b7s.persist_tpreq b7s.val 1
execute if score @s b7s.val matches 2147483648.. if score @s b7s.val matches 0 run scoreboard players set #b7s.persist_tpreq b7s.val 0
execute if score @s b7s.val matches 2147483648.. unless score @s b7s.val matches 0 run scoreboard players set #b7s.persist_tpreq b7s.val 1
9 changes: 2 additions & 7 deletions data/b7s/functions/entity/home/set_loc.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,5 @@
# /scoreboard players set <entity> b7s.rot_y <rot_y>
# /execute as <entity> run function b7s:entity/home/set_loc

scoreboard players operation @s b7s._val = @s b7s.val

function b7s:config/home/get_save_as_tags
execute if score @s b7s.val matches 1 run function b7s:entity/home/set_loc/_if_save_as_tags
execute unless score @s b7s.val matches 1 run function b7s:entity/home/set_loc/_unless_save_as_tags

scoreboard players operation @s b7s.val = @s b7s._val
execute unless score #b7s.save_home_as_tags b7s.val matches 0 run function b7s:entity/home/set_loc/_if_save_as_tags
execute if score #b7s.save_home_as_tags b7s.val matches 0 run function b7s:entity/home/set_loc/_unless_save_as_tags
3 changes: 2 additions & 1 deletion data/b7s/functions/tick.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

scoreboard objectives add b7s.val dummy
execute unless score #b7s._version b7s.val matches 10000.. run function b7s:tick/_unless_v10000_installed

execute unless score #b7s._version b7s.val matches 10100.. run function b7s:tick/_unless_v10100_installed

execute as @e[type=minecraft:player] run function b7s:tick/_as_player
8 changes: 8 additions & 0 deletions data/b7s/functions/tick/_as_player.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

scoreboard players operation @s b7s._val = @s b7s.val

execute unless score @s b7s.id matches -2147483648.. run function b7s:tick/_as_player_unless_id_set

execute if score @s b7s._left matches -2147483648.. run function b7s:tick/_as_player_if_left

execute if entity @s[nbt={Sleeping:0B}] run scoreboard players reset @s b7s._sleep_time
execute unless entity @s[nbt={Sleeping:0B}] run scoreboard players add @s b7s._sleep_time 1
execute if score @s b7s._sleep_time matches 100.. unless score #b7s.multiplayer_bed b7s.val matches 0 run function b7s:tick/_as_player_if_sleeping_if_multiplayer_bed_enabled

scoreboard players enable @s b7s.getinfo
execute unless score @s b7s.getinfo matches 0 run function b7s:command/getinfo
execute unless score @s b7s.getinfo matches 0 run scoreboard players reset @s b7s.getinfo
Expand Down Expand Up @@ -33,3 +39,5 @@ execute unless score @s b7s.tpaccept matches 0 run scoreboard players reset @s b
scoreboard players enable @s b7s.tpback
execute unless score @s b7s.tpback matches 0 run function b7s:command/tpback
execute unless score @s b7s.tpback matches 0 run scoreboard players reset @s b7s.tpback

scoreboard players operation @s b7s.val = @s b7s.val
13 changes: 2 additions & 11 deletions data/b7s/functions/tick/_as_player_if_left.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,5 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

scoreboard players operation @s b7s._val = @s b7s.val

function b7s:config/tp_req/get_persist
scoreboard players reset @s[scores={b7s.val=0}] b7s.tp_req_from

function b7s:config/back/get_persist
execute if score @s b7s.val matches 0 run function b7s:entity/back/unset_loc

scoreboard players operation @s b7s.val = @s b7s.val

scoreboard players reset @s b7s._left
execute if score #b7s.persist_tpreq b7s.val matches 0 run scoreboard players reset @s b7s.tp_req_from
execute if score #b7s.persist_back b7s.val matches 0 run function b7s:entity/back/unset_loc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

execute store result score @s b7s._tmp_1 run gamerule doDaylightCycle
execute unless score @s b7s._tmp_1 matches 0 run scoreboard players set @s b7s.val 0
execute unless score @s b7s._tmp_1 matches 0 run function b7s:world/set_daytime

execute store result score @s b7s._tmp_1 run gamerule doWeatherCycle
execute unless score @s b7s._tmp_1 matches 0 run weather clear 0
2 changes: 0 additions & 2 deletions data/b7s/functions/tick/_unless_v10000_installed.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,3 @@ scoreboard players set #b7s.save_tp_req_as_tags b7s.val 0
scoreboard players set #b7s.persist_tp_req b7s.val 0
scoreboard players set #b7s.save_back_as_tags b7s.val 0
scoreboard players set #b7s.persist_back b7s.val 0

scoreboard players set #b7s._version b7s.val 10000
11 changes: 11 additions & 0 deletions data/b7s/functions/tick/_unless_v10100_installed.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

execute unless score #b7s._version b7s.val matches 10000.. run function b7s:tick/_unless_v10000_installed

scoreboard objectives add b7s._sleep_time dummy

scoreboard players set #b7s.multiplayer_bed b7s.val 1

scoreboard players set #b7s._version b7s.val 10100
52 changes: 52 additions & 0 deletions data/b7s/functions/world/set_daytime.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

# Sets the daytime of the world. Using this function is completely different
# from using "/time set <time>", as the latter will reset Minecraft's day
# count to time % 24000, which is not always desirable.
#
# Scores required:
# b7s.val - to the new desired daytime
#
# Usage:
# /scoreboard players set @s b7s.val <time>
# /function b7s:world/set_daytime

scoreboard players operation @s b7s._tmp_1 = @s b7s.val
execute store result score @s b7s._tmp_2 run time query daytime
scoreboard players operation @s b7s._tmp_1 -= @s b7s._tmp_2
scoreboard players set @s b7s._tmp_2 24000
scoreboard players operation @s b7s._tmp_1 %= b7s._tmp_2
execute if score @s b7s._tmp_1 matches ..-1 run scoreboard players add @s b7s._tmp_1 24000

execute if score @s b7s._tmp_1 matches 16384.. run time add 16384
execute if score @s b7s._tmp_1 matches 16384.. run scoreboard players remove @s b7s._tmp_1 16384
execute if score @s b7s._tmp_1 matches 8192.. run time add 8192
execute if score @s b7s._tmp_1 matches 8192.. run scoreboard players remove @s b7s._tmp_1 8192
execute if score @s b7s._tmp_1 matches 4096.. run time add 4096
execute if score @s b7s._tmp_1 matches 4096.. run scoreboard players remove @s b7s._tmp_1 4096
execute if score @s b7s._tmp_1 matches 2048.. run time add 2048
execute if score @s b7s._tmp_1 matches 2048.. run scoreboard players remove @s b7s._tmp_1 2048
execute if score @s b7s._tmp_1 matches 1024.. run time add 1024
execute if score @s b7s._tmp_1 matches 1024.. run scoreboard players remove @s b7s._tmp_1 1024
execute if score @s b7s._tmp_1 matches 512.. run time add 512
execute if score @s b7s._tmp_1 matches 512.. run scoreboard players remove @s b7s._tmp_1 512
execute if score @s b7s._tmp_1 matches 256.. run time add 256
execute if score @s b7s._tmp_1 matches 256.. run scoreboard players remove @s b7s._tmp_1 256
execute if score @s b7s._tmp_1 matches 128.. run time add 128
execute if score @s b7s._tmp_1 matches 128.. run scoreboard players remove @s b7s._tmp_1 128
execute if score @s b7s._tmp_1 matches 64.. run time add 64
execute if score @s b7s._tmp_1 matches 64.. run scoreboard players remove @s b7s._tmp_1 64
execute if score @s b7s._tmp_1 matches 32.. run time add 32
execute if score @s b7s._tmp_1 matches 32.. run scoreboard players remove @s b7s._tmp_1 32
execute if score @s b7s._tmp_1 matches 16.. run time add 16
execute if score @s b7s._tmp_1 matches 16.. run scoreboard players remove @s b7s._tmp_1 16
execute if score @s b7s._tmp_1 matches 8.. run time add 8
execute if score @s b7s._tmp_1 matches 8.. run scoreboard players remove @s b7s._tmp_1 8
execute if score @s b7s._tmp_1 matches 4.. run time add 4
execute if score @s b7s._tmp_1 matches 4.. run scoreboard players remove @s b7s._tmp_1 4
execute if score @s b7s._tmp_1 matches 2.. run time add 2
execute if score @s b7s._tmp_1 matches 2.. run scoreboard players remove @s b7s._tmp_1 2
execute if score @s b7s._tmp_1 matches 1.. run time add 1
execute if score @s b7s._tmp_1 matches 1.. run scoreboard players remove @s b7s._tmp_1 1
31 changes: 31 additions & 0 deletions data/b7s/functions/world/set_daytime.mcfunction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

print('# This Source Code Form is subject to the terms of the Mozilla Public')
print('# License, v. 2.0. If a copy of the MPL was not distributed with this')
print('# file, You can obtain one at http://mozilla.org/MPL/2.0/.')
print()
print('# Sets the daytime of the world. Using this function is completely different')
print('# from using "/time set <time>", as the latter will reset Minecraft\'s day')
print('# count to time % 24000, which is not always desirable.')
print('#')
print('# Scores required:')
print('# b7s.val - to the new desired daytime')
print('#')
print('# Usage:')
print('# /scoreboard players set @s b7s.val <time>')
print('# /function b7s:world/set_daytime')
print()

print('scoreboard players operation @s b7s._tmp_1 = @s b7s.val')
print('execute store result score @s b7s._tmp_2 run time query daytime')
print('scoreboard players operation @s b7s._tmp_1 -= @s b7s._tmp_2')
print('scoreboard players set @s b7s._tmp_2 24000')
print('scoreboard players operation @s b7s._tmp_1 %= b7s._tmp_2')
print('execute if score @s b7s._tmp_1 matches ..-1 run scoreboard players add @s b7s._tmp_1 24000')
print()

for i in range(14, -1, -1):
print('execute if score @s b7s._tmp_1 matches {}.. run time add {}'.format(2 ** i, 2** i))
print('execute if score @s b7s._tmp_1 matches {}.. run scoreboard players remove @s b7s._tmp_1 {}'.format(2 ** i, 2** i))

0 comments on commit 3365919

Please sign in to comment.