Skip to content

Commit

Permalink
1. Follow official conventions
Browse files Browse the repository at this point in the history
2. Fix edge case where the function choose the wrong ladder to break
  • Loading branch information
oOBoomberOo committed May 7, 2020
1 parent d7d4b94 commit 97e2bf2
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 38 deletions.
18 changes: 0 additions & 18 deletions data/boomber/advancements/boomber.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"announce_to_chat": false,
"show_toast": false
},
"parent": "boomber:boomber",
"parent": "global:boomber",
"criteria": {
"trigger": {
"trigger": "minecraft:tick"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
scoreboard players set #bb.rl.raycast bb.success 0
scoreboard players set #raycast bb.rl.var 0
execute if predicate boomber:rope_ladder/is_sneaking at @s anchored eyes positioned ^ ^ ^0.1 anchored feet run function boomber:rope_ladder/event/place_ladder/raycast

advancement revoke @s only boomber:rope_ladder/event/place_ladder
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
execute store result score #bb.rl.ladder bb.variable run clear @s minecraft:ladder 0
execute if entity @s[gamemode=creative] run scoreboard players set #bb.rl.ladder bb.variable 2147483647
execute store result score #ladder bb.rl.var run clear @s minecraft:ladder 0
execute if entity @s[gamemode=creative] run scoreboard players set #ladder bb.rl.var 2147483647

scoreboard players set #bb.rl.iteration bb.variable 0
scoreboard players set #iteration bb.rl.var 0
function boomber:rope_ladder/ladder/rope

scoreboard players operation #bb.rl.amount bb.variable = #bb.rl.iteration bb.variable
scoreboard players remove #bb.rl.amount bb.variable 1
scoreboard players operation #amount bb.rl.var = #iteration bb.rl.var
scoreboard players remove #amount bb.rl.var 1
execute if entity @s[gamemode=!creative] run function boomber:rope_ladder/ladder/take

scoreboard players set #bb.rl.raycast bb.success 1
scoreboard players set #raycast bb.rl.var 1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
execute align xyz positioned ~0.5 ~0.5 ~0.5 if block ~ ~ ~ minecraft:ladder if block ~ ~-1 ~ #boomber:rope_ladder/air run function boomber:rope_ladder/event/place_ladder/found

execute as @s[distance=..5.5] if score #bb.rl.raycast bb.success matches 0 positioned ^ ^ ^0.1 run function boomber:rope_ladder/event/place_ladder/raycast
execute as @s[distance=..5.5] if score #raycast bb.rl.var matches 0 positioned ^ ^ ^0.1 run function boomber:rope_ladder/event/place_ladder/raycast
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ execute positioned ~ ~-1 ~ if block ~ ~ ~ minecraft:ladder run function boomber:
execute if block ~ ~ ~ minecraft:ladder[waterlogged=false] run setblock ~ ~ ~ minecraft:air replace
execute if block ~ ~ ~ minecraft:ladder[waterlogged=true] run setblock ~ ~ ~ minecraft:water replace

execute at @s run summon item ~ ~ ~ {Item: {id: 'minecraft:ladder', Count: 1b}, PickupDelay: 0s}
execute at @s run summon item ~ ~ ~ {Item: {id: "minecraft:ladder", Count: 1b}, PickupDelay: 0s}
4 changes: 2 additions & 2 deletions data/boomber/functions/rope_ladder/ladder/rope.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function boomber:rope_ladder/ladder/place

scoreboard players add #bb.rl.iteration bb.variable 1
execute positioned ~ ~-1 ~ if block ~ ~ ~ #boomber:rope_ladder/air if score #bb.rl.iteration bb.variable < #bb.rl.ladder bb.variable run function boomber:rope_ladder/ladder/rope
scoreboard players add #iteration bb.rl.var 1
execute positioned ~ ~-1 ~ if block ~ ~ ~ #boomber:rope_ladder/air if score #iteration bb.rl.var < #ladder bb.rl.var run function boomber:rope_ladder/ladder/rope
4 changes: 2 additions & 2 deletions data/boomber/functions/rope_ladder/ladder/take.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
clear @s minecraft:ladder 1

scoreboard players remove #bb.rl.amount bb.variable 1
execute if score #bb.rl.amount bb.variable matches 1.. run function boomber:rope_ladder/ladder/take
scoreboard players remove #amount bb.rl.var 1
execute if score #amount bb.rl.var matches 1.. run function boomber:rope_ladder/ladder/take
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
kill @e[type=item, nbt={Item: {id: 'minecraft:ladder', Count: 1b}, Age: 0s}, distance=..0.8]
kill @e[type=item, nbt={Item: {id: "minecraft:ladder", Count: 1b}, Age: 0s}, distance=..0.8, tag=!global.ignore, limit=1]
execute align xyz positioned ~0.5 ~0.5 ~0.5 run function boomber:rope_ladder/ladder/remove
Original file line number Diff line number Diff line change
@@ -1 +1 @@
execute at @e[type=item, nbt={Item: {id: 'minecraft:ladder', Count: 1b}, Age: 0s}] if block ~ ~-1 ~ minecraft:ladder run function boomber:rope_ladder/player/mine/found
execute at @e[type=item, nbt={Item: {id: "minecraft:ladder", Count: 1b}, Age: 0s}, tag=!global.ignore, limit=1, sort=nearest] if block ~ ~-1 ~ minecraft:ladder run function boomber:rope_ladder/player/mine/found
4 changes: 2 additions & 2 deletions data/boomber/functions/rope_ladder/setup.mcfunction
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
scoreboard objectives add bb.variable dummy
scoreboard objectives add bb.success dummy
scoreboard objectives add bb.rl.var dummy
scoreboard objectives add bb.rl.var dummy
scoreboard objectives add bb.rl.mine minecraft.mined:minecraft.ladder
18 changes: 18 additions & 0 deletions data/global/advancements/boomber.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"display": {
"title": "Boomber",
"description": "",
"icon": {
"item": "minecraft:player_head",
"nbt": "{SkullOwner: 'Boomber'}"
},
"announce_to_chat": false,
"show_toast": false
},
"parent": "global:root",
"criteria": {
"trigger": {
"trigger": "minecraft:tick"
}
}
}
2 changes: 1 addition & 1 deletion data/global/advancements/root.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"icon": {
"item": "minecraft:knowledge_book"
},
"background": "minecraft:textures/block/black_concrete_powder.png",
"background": "minecraft:textures/block/gray_concrete.png",
"show_toast": false,
"announce_to_chat": false

Expand Down
2 changes: 1 addition & 1 deletion pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"pack": {
"pack_format": 1,
"pack_format": 5,
"description": "Long overdue Rope Ladder datapack"
}
}

0 comments on commit 97e2bf2

Please sign in to comment.