Skip to content

Commit

Permalink
Merge branch 'release/v0.2-mc1.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
xmamo committed Aug 12, 2017
2 parents 773a30f + 2fa5e85 commit 08e19be
Show file tree
Hide file tree
Showing 12 changed files with 250 additions and 242 deletions.
5 changes: 5 additions & 0 deletions functions/b7s/command/info.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# 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/.

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":"www.mcbarebones.com","clickEvent":{"action":"open_url","value":"http://www.mcbarebones.com/"},"hoverEvent":{"action":"show_text","value":"Click here to visit BareBones' website"}}]
334 changes: 132 additions & 202 deletions functions/b7s/entity/get_pos.mcfunction

Large diffs are not rendered by default.

26 changes: 8 additions & 18 deletions functions/b7s/entity/get_pos.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,26 @@
print('# Usage:')
print('# /execute <entity> ~ ~ ~ function b7s:entity/get_pos')
print()
print('scoreboard players tag @s add b7s:_self')
print()
print('scoreboard players set @s b7s:x -30000000')
print('scoreboard players set @s b7s:y -4096')
print('scoreboard players set @s b7s:z -30000000')
print()
print('summon minecraft:area_effect_cloud ~ ~ ~ {Tags:["b7s:_marker_1"]}')
print('summon minecraft:area_effect_cloud ~ ~ ~ {Tags:["b7s:_marker_2"]}')
print('summon minecraft:area_effect_cloud ~ ~ ~ {Tags:["b7s:_marker"]}')

print()
for exponent in range(25, -1, -1):
print('tp @e[tag=b7s:_marker_1] ~{} ~ ~'.format(-2 ** exponent))
print('execute @e[tag=b7s:_marker_1] ~ ~ ~ execute @e[tag=b7s:_marker_2,rm=0] ~ ~ ~ scoreboard players add @e[tag=b7s:_self] b7s:x {}'.format(2 ** exponent))
print('tp @e[tag=b7s:_marker_2] @e[tag=b7s:_marker_1]')
print('tp @e[tag=b7s:_marker] ~{} ~ ~'.format(-2 ** exponent))
print('scoreboard players add @s[score_b7s:success_cnt_min=1] b7s:x {}'.format(2 ** exponent))

print()
for exponent in range(12, -1, -1):
print('tp @e[tag=b7s:_marker_1] ~ ~{} ~'.format(-2 ** exponent))
print('execute @e[tag=b7s:_marker_1] ~ ~ ~ execute @e[tag=b7s:_marker_2,rm=0] ~ ~ ~ scoreboard players add @e[tag=b7s:_self] b7s:y {}'.format(2 ** exponent))
print('tp @e[tag=b7s:_marker_2] @e[tag=b7s:_marker_1]')
print('tp @e[tag=b7s:_marker] ~ ~{} ~'.format(-2 ** exponent))
print('scoreboard players add @s[score_b7s:success_cnt_min=1] b7s:y {}'.format(2 ** exponent))

print()
for exponent in range(25, -1, -1):
print('tp @e[tag=b7s:_marker_1] ~ ~ ~{}'.format(-2 ** exponent))
print('execute @e[tag=b7s:_marker_1] ~ ~ ~ execute @e[tag=b7s:_marker_2,rm=0] ~ ~ ~ scoreboard players add @e[tag=b7s:_self] b7s:z {}'.format(2 ** exponent))
if exponent != 0:
print('tp @e[tag=b7s:_marker_2] @e[tag=b7s:_marker_1]')
print('tp @e[tag=b7s:_marker] ~ ~ ~{}'.format(-2 ** exponent))
print('scoreboard players add @s[score_b7s:success_cnt_min=1] b7s:z {}'.format(2 ** exponent))

print()
print('kill @e[tag=b7s:_marker_1]')
print('kill @e[tag=b7s:_marker_2]')
print()
print('scoreboard players tag @s remove b7s:_self')
print('kill @e[tag=b7s:_marker]')
46 changes: 28 additions & 18 deletions functions/b7s/entity/player/update.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,45 @@ function b7sp:entity/player/pre_update
scoreboard players reset @s[score_b7s:_left_min=1] b7s:req_from
scoreboard players reset @s[score_b7s:_left_min=1] b7s:_left

function b7s:entity/track_success_cnt unless @s[score_b7s:success_cnt_min=-2147483648]
function b7s:entity/track_aff_blocks unless @s[score_b7s:aff_blocks_min=-2147483648]
function b7s:entity/track_aff_entities unless @s[score_b7s:aff_entities_min=-2147483648]
function b7s:entity/track_aff_items unless @s[score_b7s:aff_items_min=-2147483648]
function b7s:entity/track_query_result unless @s[score_b7s:query_result_min=-2147483648]

scoreboard players add @s b7s:id 0
execute @s[score_b7s:id=0] ~ ~ ~ scoreboard players add b7s:_dummy b7s:id 1
scoreboard players operation @s[score_b7s:id=0] b7s:id = b7s:_dummy b7s:id

execute @s[tag=!b7s:initialized] ~ ~ ~ function b7sp:entity/player/welcome
scoreboard players tag @s[tag=!b7s:initialized] add b7s:initialized

scoreboard players enable @s[tag=b7s:initialized] b7s:tpspawn
execute @s[tag=b7s:initialized,score_b7s:tpspawn_min=1] ~ ~ ~ function b7s:command/tpspawn
scoreboard players set @s[tag=b7s:initialized,score_b7s:tpspawn_min=1] b7s:tpspawn 0
scoreboard players enable @s b7s:info
execute @s[score_b7s:info_min=1] ~ ~ ~ function b7s:command/info
scoreboard players set @s[score_b7s:info_min=1] b7s:info 0

scoreboard players enable @s b7s:tpspawn
execute @s[score_b7s:tpspawn_min=1] ~ ~ ~ function b7s:command/tpspawn
scoreboard players set @s[score_b7s:tpspawn_min=1] b7s:tpspawn 0

scoreboard players enable @s[tag=b7s:initialized] b7s:sethome
execute @s[tag=b7s:initialized,score_b7s:sethome_min=1] ~ ~ ~ function b7s:command/sethome
scoreboard players set @s[tag=b7s:initialized,score_b7s:sethome_min=1] b7s:sethome 0
scoreboard players enable @s b7s:sethome
execute @s[score_b7s:sethome_min=1] ~ ~ ~ function b7s:command/sethome
scoreboard players set @s[score_b7s:sethome_min=1] b7s:sethome 0

scoreboard players enable @s[tag=b7s:initialized] b7s:tphome
execute @s[tag=b7s:initialized,score_b7s:tphome_min=1] ~ ~ ~ function b7s:command/tphome
scoreboard players set @s[tag=b7s:initialized,score_b7s:tphome_min=1] b7s:tphome 0
scoreboard players enable @s b7s:tphome
execute @s[score_b7s:tphome_min=1] ~ ~ ~ function b7s:command/tphome
scoreboard players set @s[score_b7s:tphome_min=1] b7s:tphome 0

scoreboard players enable @s[tag=b7s:initialized] b7s:tpback
execute @s[tag=b7s:initialized,score_b7s:tpback_min=1] ~ ~ ~ function b7s:command/tpback
scoreboard players set @s[tag=b7s:initialized,score_b7s:tpback_min=1] b7s:tpback 0
scoreboard players enable @s b7s:tpback
execute @s[score_b7s:tpback_min=1] ~ ~ ~ function b7s:command/tpback
scoreboard players set @s[score_b7s:tpback_min=1] b7s:tpback 0

scoreboard players enable @s[tag=b7s:initialized] b7s:tpreq
execute @s[tag=b7s:initialized,score_b7s:tpreq_min=1] ~ ~ ~ function b7s:command/tpreq
scoreboard players set @s[tag=b7s:initialized,score_b7s:tpreq_min=1] b7s:tpreq 0
scoreboard players enable @s b7s:tpreq
execute @s[score_b7s:tpreq_min=1] ~ ~ ~ function b7s:command/tpreq
scoreboard players set @s[score_b7s:tpreq_min=1] b7s:tpreq 0

scoreboard players enable @s[tag=b7s:initialized] b7s:tpaccept
execute @s[tag=b7s:initialized,score_b7s:tpaccept_min=1] ~ ~ ~ function b7s:command/tpaccept
scoreboard players set @s[tag=b7s:initialized,score_b7s:tpaccept_min=1] b7s:tpaccept 0
scoreboard players enable @s b7s:tpaccept
execute @s[score_b7s:tpaccept_min=1] ~ ~ ~ function b7s:command/tpaccept
scoreboard players set @s[score_b7s:tpaccept_min=1] b7s:tpaccept 0

function b7sp:entity/player/post_update
3 changes: 2 additions & 1 deletion functions/b7s/entity/pulse.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
# Usage:
# execute <entity> ~ ~ ~ function b7s:entity/pulse

function b7s:entity/track_success_cnt
fill ~ ~ ~ ~ ~ ~ minecraft:redstone_block 0 replace minecraft:air
fill ~ ~ ~ ~ ~ ~ minecraft:air 0 replace minecraft:redstone_block
execute @s[score_b7s:success_cnt_min=1] ~ ~ ~ setblock ~ ~ ~ minecraft:air
13 changes: 13 additions & 0 deletions functions/b7s/entity/track_aff_blocks.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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/.

# Tracks the AffectedBlocks stat of an entity. Result is stored in the
# entity's `b7s:aff_blocks` score. Players are tracked by default, so you
# don't need to call this function on them.
#
# Usage:
# /execute <entity> ~ ~ ~ function b7s:entity/track_aff_blocks

scoreboard players set @s b7s:aff_blocks 0
stats entity @s set AffectedBlocks @s b7s:aff_blocks
13 changes: 13 additions & 0 deletions functions/b7s/entity/track_aff_entities.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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/.

# Tracks the AffectedEntities stat of an entity. Result is stored in the
# entity's `b7s:aff_entities` score. Players are tracked by default, so you
# don't need to call this function on them.
#
# Usage:
# /execute <entity> ~ ~ ~ function b7s:entity/track_aff_entities

scoreboard players set @s b7s:aff_entities 0
stats entity @s set AffectedEntities @s b7s:aff_entities
13 changes: 13 additions & 0 deletions functions/b7s/entity/track_aff_items.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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/.

# Tracks the AffectedItems stat of an entity. Result is stored in the entity's
# `b7s:aff_items` score. Players are tracked by default, so you don't need to
# call this function on them.
#
# Usage:
# /execute <entity> ~ ~ ~ function b7s:entity/track_aff_items

scoreboard players set @s b7s:aff_items 0
stats entity @s set AffectedItems @s b7s:aff_items
13 changes: 13 additions & 0 deletions functions/b7s/entity/track_query_result.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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/.

# Tracks the QueryResult stat of an entity. Result is stored in the entity's
# `b7s:query_result` score. Players are tracked by default, so you don't need
# to call this function on them.
#
# Usage:
# /execute <entity> ~ ~ ~ function b7s:entity/track_query_result

scoreboard players set @s b7s:query_result 0
stats entity @s set QueryResult @s b7s:query_result
13 changes: 13 additions & 0 deletions functions/b7s/entity/track_success_cnt.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 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/.

# Tracks the SuccessCount stat of an entity. Result is stored in the entity's
# `b7s:success_cnt` score. Players are tracked by default, so you don't need to
# call this function on them.
#
# Usage:
# /execute <entity> ~ ~ ~ function b7s:entity/track_success_cnt

scoreboard players set @s b7s:success_cnt 0
stats entity @s set SuccessCount @s b7s:success_cnt
10 changes: 7 additions & 3 deletions functions/b7s/install.mcfunction
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ gamerule commandBlockOutput false
gamerule logAdminCommands false

scoreboard objectives add b7s:_tmp dummy

scoreboard objectives add b7s:_left stat.leaveGame

scoreboard objectives add b7s:id dummy
scoreboard objectives add b7s:aff_blocks dummy
scoreboard objectives add b7s:aff_entities dummy
scoreboard objectives add b7s:aff_items dummy
scoreboard objectives add b7s:query_result dummy
scoreboard objectives add b7s:success_cnt dummy

scoreboard objectives add b7s:id dummy
scoreboard objectives add b7s:biome dummy

scoreboard objectives add b7s:req_from dummy

scoreboard objectives add b7s:dim dummy
Expand All @@ -28,6 +31,7 @@ scoreboard objectives add b7s:z dummy
scoreboard objectives add b7s:rot_x dummy
scoreboard objectives add b7s:rot_y dummy

scoreboard objectives add b7s:info trigger
scoreboard objectives add b7s:sethome trigger
scoreboard objectives add b7s:tphome trigger
scoreboard objectives add b7s:tpback trigger
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ extend the server's functionality.
BareBones installs a series of custom commands, accessible through triggers.
Below are all commands accessible as of the current version.

### `/trigger b7s:info set 1`
Displays basic information about the BareBones data pack.

### `/trigger b7s:sethome set 1`
Sets your home location. You can teleport back to it using
`/trigger b7s:tphome set 1`
Expand Down

0 comments on commit 08e19be

Please sign in to comment.