Skip to content

Commit 665a4d3

Browse files
committed
added pickblock functionality
made it so when you pickblock a spawner with a debug stick it gives you the spawner instead of a horse spawn egg 😄
1 parent fbe9215 commit 665a4d3

File tree

7 files changed

+76
-44
lines changed

7 files changed

+76
-44
lines changed

data/bse/functions/player/looking_at_spawner.mcfunction

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ kill 627365-0-0-0-1
1212
execute store result score has_bse_id= bse.temp if data block ~ ~ ~ SpawnData.entity."bse:id"
1313
execute store result score alt= bse.temp if predicate bse:alt
1414

15+
execute if score has_bse_id= bse.temp matches 1 store result score @s bse.id run data get block ~ ~ ~ SpawnData.entity."bse:id"
16+
execute if score has_bse_id= bse.temp matches 0 store result score @s bse.id run scoreboard players reset @s bse.id
17+
1518
execute if score has_bse_id= bse.temp matches 0 run title @s actionbar [{"keybind":"key.use","color":"aqua"},{"text":" to register this spawner","color":"aqua"}]
1619
execute if score has_bse_id= bse.temp matches 1 if score alt= bse.temp matches 0 run title @s actionbar [{"text":"","color":"gray"},{"keybind":"key.use","color":"aqua"},{"text":" to get","color":"aqua"}," | ",[{"keybind":"key.sneak","color":"aqua"}," for more options"]]
1720
execute if score has_bse_id= bse.temp matches 1 if score alt= bse.temp matches 1 run title @s actionbar [{"text":"","color":"gray"},{"keybind":"key.use","color":"aqua"},{"text":" to update","color":"aqua"}," | ",[{"keybind":"key.attack","color":"aqua"}," to un-register"]]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#generating item
2+
scoreboard players operation id= bse.main = @s bse.id
3+
function bse:util/gs
4+
5+
#replacing item into hand
6+
item replace block 29999999 0 6452069 container.0 with stick
7+
data modify block 29999999 0 6452069 Items[0] merge from storage bse:main item
8+
item replace entity @s weapon.mainhand from block 29999999 0 6452069 container.0
9+
10+
data remove storage bse:main item

data/bse/functions/player/stop_looking_at_spawner.mcfunction

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ tag @s remove bse.las
22
tag @s remove bse.tool
33
title @s actionbar ""
44

5+
execute if predicate bse:hse if score @s bse.id matches 0.. run function bse:player/pick_block_spawner
6+
execute if predicate bse:hse unless score @s bse.id matches 0.. run item replace entity @s weapon.mainhand with air
7+
scoreboard players reset @s bse.id
8+
59
execute if score @s bse.temp matches 00 run data merge entity 627365-0-0-0-10 {Pos:[29999999d,0d,6452069d]}
610
execute if score @s bse.temp matches 01 run data merge entity 627365-0-0-0-11 {Pos:[29999999d,0d,6452069d]}
711
execute if score @s bse.temp matches 02 run data merge entity 627365-0-0-0-12 {Pos:[29999999d,0d,6452069d]}
Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,6 @@
1-
function bse:util/si
2-
data modify storage bse:main current set from storage bse:main spawners[{selected:1b}].data
3-
4-
#setting up item object
5-
data modify storage bse:main item set value {id:"minecraft:command_block",Count:1b,tag:{BlockEntityTag:{auto:1b,Command:"function bse:spawner/place",LastExecution:0L},display:{Name:"",Lore:[]}}}
6-
7-
#grabbing requested id from current
8-
execute store result storage bse:main item.tag.BlockEntityTag.LastExecution long 1 run scoreboard players get id= bse.main
9-
10-
#generating name
11-
data modify block 29999999 1 6452069 Text1 set value '[{"text":"","italic":false},{"text":"Place Spawner","color":"yellow"}," ",{"translate":"[ID: %s]","with":[{"score":{"objective":"bse.main","name":"id="},"color":"gold"}],"color":"gray"}]'
12-
data modify storage bse:main item.tag.display.Name set from block 29999999 1 6452069 Text1
13-
14-
##generating general data lore
15-
data modify storage bse:main item.tag.display.Lore append value '[{"text":"General properties:","color":"white","italic":false}]'
16-
#ranges
17-
execute store result storage bse:main temps.1 int 1 run data get storage bse:main current.RequiredPlayerRange
18-
execute store result storage bse:main temps.2 int 1 run data get storage bse:main current.SpawnRange
19-
data modify block 29999999 1 6452069 Text1 set value '[{"translate":" Player Range: %s, Spawn Range: %s","color":"gray","italic":false,"with":[{"nbt":"temps.1","storage":"bse:main","color":"gold"},{"nbt":"temps.2","storage":"bse:main","color":"gold"}]}]'
20-
data modify storage bse:main item.tag.display.Lore append from block 29999999 1 6452069 Text1
21-
22-
#delays
23-
execute store result storage bse:main temps.1 int 1 run data get storage bse:main current.MaxSpawnDelay
24-
execute store result storage bse:main temps.2 int 1 run data get storage bse:main current.MinSpawnDelay
25-
data modify block 29999999 1 6452069 Text1 set value '[{"translate":" Max Delay: %s, Min Delay: %s","color":"gray","italic":false,"with":[{"nbt":"temps.1","storage":"bse:main","color":"gold"},{"nbt":"temps.2","storage":"bse:main","color":"gold"}]}]'
26-
data modify storage bse:main item.tag.display.Lore append from block 29999999 1 6452069 Text1
27-
28-
#counts
29-
execute store result storage bse:main temps.1 int 1 run data get storage bse:main current.MaxNearbyEntities
30-
execute store result storage bse:main temps.2 int 1 run data get storage bse:main current.SpawnCount
31-
data modify block 29999999 1 6452069 Text1 set value '[{"translate":" Max Nearby: %s, Count: %s","color":"gray","italic":false,"with":[{"nbt":"temps.1","storage":"bse:main","color":"gold"},{"nbt":"temps.2","storage":"bse:main","color":"gold"}]}]'
32-
data modify storage bse:main item.tag.display.Lore append from block 29999999 1 6452069 Text1
33-
data modify storage bse:main item.tag.display.Lore append value '[{"text":"List of spawnable entities:","color":"white","italic":false}]'
34-
35-
##generating spawn potentials lore
36-
data modify storage bse:main spt set value []
37-
data modify storage bse:main spt set from storage bse:main current.SpawnPotentials
38-
execute unless data storage bse:main spt[0] run data modify storage bse:main spt[].data set from storage bse:main current.SpawnData
39-
function bse:spawner/give/spawner_lore
40-
data remove storage bse:main temps
41-
data remove storage bse:main spt
1+
function bse:util/gs
422

433
#summoning item
444
execute at @s run summon item ~ ~ ~ {Tags:[bse.item.new],Item:{id:"minecraft:stone",Count:1b}}
455
execute at @s as @e[type=item,tag=bse.item.new,limit=1] run data modify entity @s Item set from storage bse:main item
46-
tag @e[type=item,tag=bse.item.new,limit=1] remove bse.item.new
47-
data remove storage bse:main item
6+
tag @e[type=item,tag=bse.item.new,limit=1] remove bse.item.new

data/bse/functions/util/gs.mcfunction

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
function bse:util/si
2+
data modify storage bse:main current set from storage bse:main spawners[{selected:1b}].data
3+
4+
#setting up item object
5+
data remove storage bse:main item
6+
data modify storage bse:main item set value {id:"minecraft:command_block",Count:1b,tag:{BlockEntityTag:{auto:1b,Command:"function bse:spawner/place",LastExecution:0L},display:{Name:"",Lore:[]}}}
7+
8+
#grabbing requested id from current
9+
execute store result storage bse:main item.tag.BlockEntityTag.LastExecution long 1 run scoreboard players get id= bse.main
10+
11+
#generating name
12+
data modify block 29999999 1 6452069 Text1 set value '[{"text":"","italic":false},{"text":"Place Spawner","color":"yellow"}," ",{"translate":"[ID: %s]","with":[{"score":{"objective":"bse.main","name":"id="},"color":"gold"}],"color":"gray"}]'
13+
data modify storage bse:main item.tag.display.Name set from block 29999999 1 6452069 Text1
14+
15+
##generating general data lore
16+
data modify storage bse:main item.tag.display.Lore append value '[{"text":"General properties:","color":"white","italic":false}]'
17+
#ranges
18+
execute store result storage bse:main temps.1 int 1 run data get storage bse:main current.RequiredPlayerRange
19+
execute store result storage bse:main temps.2 int 1 run data get storage bse:main current.SpawnRange
20+
data modify block 29999999 1 6452069 Text1 set value '[{"translate":" Player Range: %s, Spawn Range: %s","color":"gray","italic":false,"with":[{"nbt":"temps.1","storage":"bse:main","color":"gold"},{"nbt":"temps.2","storage":"bse:main","color":"gold"}]}]'
21+
data modify storage bse:main item.tag.display.Lore append from block 29999999 1 6452069 Text1
22+
23+
#delays
24+
execute store result storage bse:main temps.1 int 1 run data get storage bse:main current.MaxSpawnDelay
25+
execute store result storage bse:main temps.2 int 1 run data get storage bse:main current.MinSpawnDelay
26+
data modify block 29999999 1 6452069 Text1 set value '[{"translate":" Max Delay: %s, Min Delay: %s","color":"gray","italic":false,"with":[{"nbt":"temps.1","storage":"bse:main","color":"gold"},{"nbt":"temps.2","storage":"bse:main","color":"gold"}]}]'
27+
data modify storage bse:main item.tag.display.Lore append from block 29999999 1 6452069 Text1
28+
29+
#counts
30+
execute store result storage bse:main temps.1 int 1 run data get storage bse:main current.MaxNearbyEntities
31+
execute store result storage bse:main temps.2 int 1 run data get storage bse:main current.SpawnCount
32+
data modify block 29999999 1 6452069 Text1 set value '[{"translate":" Max Nearby: %s, Count: %s","color":"gray","italic":false,"with":[{"nbt":"temps.1","storage":"bse:main","color":"gold"},{"nbt":"temps.2","storage":"bse:main","color":"gold"}]}]'
33+
data modify storage bse:main item.tag.display.Lore append from block 29999999 1 6452069 Text1
34+
data modify storage bse:main item.tag.display.Lore append value '[{"text":"List of spawnable entities:","color":"white","italic":false}]'
35+
36+
##generating spawn potentials lore
37+
data modify storage bse:main spt set value []
38+
data modify storage bse:main spt set from storage bse:main current.SpawnPotentials
39+
execute unless data storage bse:main spt[0] run data modify storage bse:main spt[].data set from storage bse:main current.SpawnData
40+
function bse:spawner/give/spawner_lore
41+
data remove storage bse:main temps
42+
data remove storage bse:main spt

data/bse/predicates/hse.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"condition": "minecraft:entity_properties",
3+
"entity": "this",
4+
"predicate": {
5+
"equipment": {
6+
"mainhand": {
7+
"items": [
8+
"minecraft:horse_spawn_egg"
9+
]
10+
}
11+
}
12+
}
13+
}

util.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ us | update all spawners in the selected spawner's positions array
1010
rcp | remove current position in 'bse:temp pos' from currently selected spawner positions array
1111
ps | places the currently selected spawner at this position
1212
pa | (prime_all_spawners) sets the delay of all registered spawners to 0
13-
ua | (unmark_all_spawners) removes all positions arrays and removes all "bse:id" values on spawners
13+
ua | (unmark_all_spawners) removes all positions arrays and removes all "bse:id" values on spawners
14+
gs | generates the spawner give item at bse:main item, requires id= bse.main score

0 commit comments

Comments
 (0)