Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
first commit, messy code
  • Loading branch information
ItsKestrel committed Dec 14, 2024
1 parent 0501d3c commit 2db8929
Show file tree
Hide file tree
Showing 201 changed files with 1,671 additions and 0 deletions.
16 changes: 16 additions & 0 deletions data/chaotic_crafting/advancement/interact_with_customer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"criteria": {
"example": {
"trigger": "minecraft:player_interacted_with_entity",
"conditions": {
"entity": {
"type": "minecraft:wandering_trader",
"nbt": "{Tags:[\"customer\"]}"
}
}
}
},
"rewards": {
"function": "chaotic_crafting:interactions/interact_with_customer"
}
}
16 changes: 16 additions & 0 deletions data/chaotic_crafting/advancement/interact_with_gui.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"criteria": {
"requirement": {
"trigger": "player_interacted_with_entity",
"conditions": {
"entity": {
"type": "interaction",
"nbt": "{Tags:[menu_item]}"
}
}
}
},
"rewards": {
"function": "chaotic_crafting:util/gui/interaction/player_menu_item_click"
}
}
16 changes: 16 additions & 0 deletions data/chaotic_crafting/advancement/menu_add_player.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"criteria": {
"requirement": {
"trigger": "player_interacted_with_entity",
"conditions": {
"entity": {
"type": "interaction",
"nbt": "{Tags:[menu_add_player]}"
}
}
}
},
"rewards": {
"function": "chaotic_crafting:util/gui/interaction/add_player"
}
}
16 changes: 16 additions & 0 deletions data/chaotic_crafting/advancement/menu_start_day.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"criteria": {
"requirement": {
"trigger": "player_interacted_with_entity",
"conditions": {
"entity": {
"type": "interaction",
"nbt": "{Tags:[menu_start_day]}"
}
}
}
},
"rewards": {
"function": "chaotic_crafting:util/gui/interaction/start_day"
}
}
22 changes: 22 additions & 0 deletions data/chaotic_crafting/advancement/place_crafter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"criteria": {
"example": {
"trigger": "minecraft:placed_block",
"conditions": {
"location": [
{
"condition": "location_check",
"predicate": {
"block": {
"blocks": "crafter"
}
}
}
]
}
}
},
"rewards": {
"function": "chaotic_crafting:functional_blocks/place_crafter"
}
}
44 changes: 44 additions & 0 deletions data/chaotic_crafting/function/check_item.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
tag @s add delivering_item
tag @s add incorrect_item

#tag @e[distance=..1,type=minecraft:wandering_trader,tag=customer] add recieved_item
execute as @s at @s run tag @e[type=wandering_trader,distance=..3] add find_looking.candidate

execute as @s at @s run function chaotic_crafting:util/find_customer

tag @e remove find_looking.candidate

execute unless entity @s[nbt=!{SelectedItem:{}}] run execute as @e[distance=..3,type=minecraft:wandering_trader,tag=customer,tag=find_looking.customer,limit=1] run tag @s add recieved_item

execute if entity @s[nbt=!{SelectedItem:{}}] run tag @s remove delivering_item
execute if entity @s[nbt=!{SelectedItem:{}}] run tag @s remove incorrect_item


execute if entity @s[nbt={SelectedItem:{id:"minecraft:wooden_pickaxe"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:wooden_pickaxe"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:wooden_shovel"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:wooden_shovel"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:wooden_axe"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:wooden_axe"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:wooden_hoe"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:wooden_hoe"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:wooden_sword"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:wooden_sword"},{}]}] run function chaotic_crafting:register_correct_order

execute if entity @s[nbt={SelectedItem:{id:"minecraft:stone_pickaxe"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:stone_pickaxe"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:stone_shovel"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:stone_shovel"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:stone_axe"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:stone_axe"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:stone_hoe"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:stone_hoe"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:stone_sword"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:stone_sword"},{}]}] run function chaotic_crafting:register_correct_order

execute if entity @s[nbt={SelectedItem:{id:"minecraft:oak_boat"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:oak_boat"},{}]}] run function chaotic_crafting:register_correct_order
execute if entity @s[nbt={SelectedItem:{id:"minecraft:ladder"}}] run execute as @e[tag=recieved_item,nbt={HandItems:[{id:"minecraft:ladder"},{}]}] run function chaotic_crafting:register_correct_order


execute if entity @s[tag=incorrect_item] run execute as @e[tag=recieved_item] run function chaotic_crafting:wrong_order

execute if entity @s[tag=delivering_item] run item replace entity @s[tag=delivering_item] weapon.mainhand with minecraft:air

execute as @e[tag=recieved_item] run function chaotic_crafting:recieved_item

advancement revoke @s only chaotic_crafting:interact_with_customer

tag @s remove correct_item
tag @s remove incorrect_item
tag @s remove delivering_item

9 changes: 9 additions & 0 deletions data/chaotic_crafting/function/correct_order.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
tellraw @a {"text": "Order Delivered","color": "green"}
playsound minecraft:entity.wandering_trader.trade player @p
scoreboard players add $correct_orders cc_points 1
execute if block 22 67 6 minecraft:jukebox{IsPlaying:1b} run scoreboard players add $music_bonus cc_points 1

execute as @s run function chaotic_crafting:open_seat
scoreboard players add $customers_served cc_customers 1

execute on passengers run kill @s
15 changes: 15 additions & 0 deletions data/chaotic_crafting/function/day_manager/day_manager.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
execute if score $day_timer cc_timer < $day_length cc_settings run scoreboard players add $day_timer cc_timer 1

#execute if score $day_timer cc_timer = $day_length cc_settings run scoreboard players set $day_active cc_settings 0
#execute if score $day_timer cc_timer = $day_length cc_settings run scoreboard players set $day_timer cc_timer 0

#Update Scoreboard
scoreboard players operation FailedOrders cc_game = $incorrect_orders cc_points
scoreboard players operation Points cc_game = $correct_orders cc_points


## Check for end of day
execute if score $customers_served cc_customers = $customer_count cc_settings run function chaotic_crafting:day_manager/succeed_day

execute if score $patience_expired cc_customers matches 1 run function chaotic_crafting:day_manager/failed_day
execute if score $incorrect_orders cc_points matches 3 run function chaotic_crafting:day_manager/failed_day
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title @a title {"text": "Day Failed","color": "red"}

scoreboard players set $day_active cc_settings 0
scoreboard players set $day_timer cc_timer 0

function chaotic_crafting:util/kill_all_customers

function chaotic_crafting:reset
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function chaotic_crafting:util/gui/close_gui

scoreboard players set $day_active cc_settings 1

function chaotic_crafting:loop/start_customer_spawning

execute if score $oak_wood_pile_spawn cc_settings matches 1 run function chaotic_crafting:loop/oak_pile_spawn
execute if score $stone_pile_spawn cc_settings matches 1 run function chaotic_crafting:loop/stone_pile_spawn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scoreboard players set $day_active cc_settings 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title @a title {"text": "Day Completed","color": "green"}

scoreboard players set $day_active cc_settings 0
scoreboard players set $day_timer cc_timer 0

scoreboard players add $day cc_settings 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
execute as @e[type=marker,tag=cc_seat_1] at @s run execute as @e[type=wandering_trader,tag=customer,tag=seat_1,tag=!at_counter,tag=rally_patience,distance=..3] run execute on passengers run scoreboard players operation @s cc_patience = $ordering_patience cc_settings
execute as @e[type=marker,tag=cc_seat_1] at @s run tag @e[type=wandering_trader,tag=customer,tag=seat_1,tag=!at_counter,distance=..3] add at_counter
execute as @e[type=wandering_trader,tag=at_counter] run tag @s remove at_rally

execute if score $bell_rang cc_customers matches 0 run playsound block.bell.use player @a
scoreboard players set $bell_rang cc_customers 1

tag @e[type=wandering_trader,tag=customer,tag=at_counter,tag=!ordering_patience] add ordering_patience
tag @e[type=wandering_trader,tag=customer,tag=at_counter,tag=ordering_patience] remove rally_patience
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
execute as @e[type=marker,tag=cc_customer_rally] at @s run execute as @e[type=wandering_trader,tag=customer,tag=!at_rally,tag=!waiting_patience,distance=..3] run execute on passengers run scoreboard players operation @s cc_patience = $rally_patience cc_settings
execute as @e[type=marker,tag=cc_customer_rally] at @s run tag @e[type=wandering_trader,tag=customer,tag=!at_rally,distance=..3] add at_rally

tag @e[type=wandering_trader,tag=customer,tag=at_rally,tag=!ordering_patience,tag=!waiting_patience] add rally_patience
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
function chaotic_crafting:events/customer_at_rally
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tellraw @a {"text": "Triggering Crafters"}
clone ~ ~-1 ~ ~ ~-1 ~ ~ -64 ~ replace
setblock ~ ~-1 ~ redstone_block
clone ~ -64 ~ ~ -64 ~ ~ ~-1 ~ replace
setblock ~ -64 ~ bedrock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
tellraw @s {"text": "Crafter Broken."}
scoreboard players set @s cc_crafter_broken 0

#Marker
execute as @e[type=marker,tag=crafter_marker] run execute at @s run execute unless block ~ ~ ~ crafter run function chaotic_crafting:functional_blocks/rm_marker_progress_bar

#Armor Stand
execute as @e[type=armor_stand,tag=crafter_marker] run execute at @s run execute unless block ~ ~ ~ crafter run function chaotic_crafting:functional_blocks/rm_marker_progress_bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
tellraw @a {"text": "Triggering Crafters"}
clone ~ ~-1 ~ ~ ~-1 ~ ~ -64 ~ replace
setblock ~ ~-1 ~ redstone_block
clone ~ -64 ~ ~ -64 ~ ~ ~-1 ~ replace
setblock ~ -64 ~ bedrock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
give @s armor_stand[custom_name='{"text": "Crafter: Level 1"}',custom_data={place_crafter:true},entity_data={id:"minecraft:armor_stand",Tags:["crafter_lvl1"],Invisible:1b,Invulnerable:1b,NoGravity:1b,Marker:1b},custom_model_data=1]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
tellraw @s {"text": "Placed Crafter."}
function chaotic_crafting:util/find_crafter/start_crafter_ray

#Marker
#execute as @e[type=marker,tag=new_crafter] run function chaotic_crafting:functional_blocks/sync_crafter_marker
execute as @e[type=marker,tag=new_crafter] run function chaotic_crafting:util/center_entity
#execute as @e[type=marker,tag=new_crafter] at @s run function chaotic_crafting:util/progress_bars/give_progress_bar


#Armor Stand
execute as @e[type=armor_stand,tag=new_crafter] run function chaotic_crafting:util/center_entity
execute as @e[type=armor_stand,tag=new_crafter] run function chaotic_crafting:functional_blocks/sync_crafter_marker
execute as @e[type=armor_stand,tag=new_crafter] at @s run function chaotic_crafting:util/progress_bars/give_progress_bar


execute as @e[type=marker,tag=new_crafter] run tag @s remove new_crafter
execute as @e[type=armor_stand,tag=new_crafter] run tag @s remove new_crafter
advancement revoke @s only chaotic_crafting:place_crafter
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#execute if entity @s facing
execute anchored eyes run execute unless block ~ ~ ~ crafter run setblock ~ ~ ~ crafter
data modify block ~ ~ ~ components set value {"custom_data": {level: 1}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
execute on passengers run kill @s
kill @s
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
execute at @s run execute if data block ~ ~ ~ components."minecraft:custom_data".level1 run tag @s add crafter_lvl1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#Determine which customer is interacted with
execute as @s at @s run tag @e[type=wandering_trader,distance=..3] add find_looking.candidate

execute as @s at @s run function chaotic_crafting:util/find_customer

tag @e remove find_looking.candidate

execute if entity @e[tag=customer,tag=find_looking.customer,tag=has_ordered] run execute unless entity @s[nbt=!{SelectedItem:{}}] run function chaotic_crafting:check_item
execute if entity @e[tag=customer,tag=find_looking.customer,tag=not_ordered] run execute as @e[tag=customer,tag=find_looking.customer,tag=not_ordered] run function chaotic_crafting:take_order

advancement revoke @s only chaotic_crafting:interact_with_customer
1 change: 1 addition & 0 deletions data/chaotic_crafting/function/kill_customer.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#kill @e[type=minecraft:villager,nbt={Pos:[0.0d,0.0d,0.0d]}]
6 changes: 6 additions & 0 deletions data/chaotic_crafting/function/load.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function chaotic_crafting:setup/setup_scoreboards
function chaotic_crafting:setup/set_anchor

function chaotic_crafting:loop/iron_spread
function chaotic_crafting:loop/gold_spread
function chaotic_crafting:loop/diamond_spread
2 changes: 2 additions & 0 deletions data/chaotic_crafting/function/loop/diamond_spread.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
execute if score $diamond_ore_spread cc_settings matches 1 run execute as @e[type=marker,tag=diamond_ore_spreader] run function chaotic_crafting:ore_spread/diamond_spread
schedule function chaotic_crafting:loop/diamond_spread 5s
2 changes: 2 additions & 0 deletions data/chaotic_crafting/function/loop/gold_spread.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
execute if score $gold_ore_spread cc_settings matches 1 run execute as @e[type=marker,tag=gold_ore_spreader] run function chaotic_crafting:ore_spread/gold_spread
schedule function chaotic_crafting:loop/gold_spread 5s
2 changes: 2 additions & 0 deletions data/chaotic_crafting/function/loop/iron_spread.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
execute if score $iron_ore_spread cc_settings matches 1 run execute as @e[type=marker,tag=iron_ore_spreader] run function chaotic_crafting:ore_spread/iron_spread
schedule function chaotic_crafting:loop/iron_spread 5s
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
execute if score $spawn_loop cc_customers > #0 cc_consts run execute if score $customers_spawned cc_customers < $customer_count cc_settings run function chaotic_crafting:spawn_customer/spawn_customer
#execute as @e[tag=new_customer] at @s run function chaotic_crafting:util/patience_bars/give_progress_bar
scoreboard players remove $spawn_loop cc_customers 1
scoreboard players add $customers_spawned cc_customers 1

execute if score $spawn_loop cc_customers > #0 cc_consts run function chaotic_crafting:loop/loop_spawn_customer
3 changes: 3 additions & 0 deletions data/chaotic_crafting/function/loop/oak_pile_spawn.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
execute if score $day_active cc_settings matches 1 run execute if score $oak_wood_pile_spawn cc_settings matches 1 run execute as @e[type=marker,tag=cc_oak_log_pile] at @s run place template chaotic_crafting:oak_log_pile_alt ~ ~ ~
tellraw @a {"text": "A log delivery has arrived.", "color": "white"}
execute if score $day_active cc_settings matches 1 run execute if score $oak_wood_pile_spawn cc_settings matches 1 run schedule function chaotic_crafting:loop/oak_pile_spawn 120s
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
execute if score $day_active cc_settings matches 1 run function chaotic_crafting:spawn_customer/spawn_customer_manager
execute if score $day_active cc_settings matches 1 run schedule function chaotic_crafting:loop/start_customer_spawning 1s
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
execute if score $day_active cc_settings matches 1 run execute if score $stone_pile_spawn cc_settings matches 1 run execute as @e[type=marker,tag=cc_stone_pile] at @s run place template chaotic_crafting:stone_pile ~ ~ ~
tellraw @a {"text": "A stone delivery has arrived.", "color": "white"}
execute if score $day_active cc_settings matches 1 run execute if score $stone_pile_spawn cc_settings matches 1 run schedule function chaotic_crafting:loop/stone_pile_spawn 180s
22 changes: 22 additions & 0 deletions data/chaotic_crafting/function/menus/menu_misc.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

scoreboard players set $random cc_item 0
scoreboard players set $min random 0
scoreboard players set $max random 11
execute run function random:uniform
execute store result score $random cc_item run scoreboard players get $out random

execute if score $random cc_item matches 0 run data modify entity @s HandItems set value [{id:"wooden_pickaxe",Count:1b}, {}]
execute if score $random cc_item matches 1 run data modify entity @s HandItems set value [{id:"wooden_shovel",Count:1b}, {}]
execute if score $random cc_item matches 2 run data modify entity @s HandItems set value [{id:"wooden_axe",Count:1b}, {}]
execute if score $random cc_item matches 3 run data modify entity @s HandItems set value [{id:"wooden_hoe",Count:1b}, {}]
execute if score $random cc_item matches 4 run data modify entity @s HandItems set value [{id:"wooden_sword",Count:1b}, {}]
execute if score $random cc_item matches 5 run data modify entity @s HandItems set value [{id:"stone_pickaxe",Count:1b}, {}]
execute if score $random cc_item matches 6 run data modify entity @s HandItems set value [{id:"stone_shovel",Count:1b}, {}]
execute if score $random cc_item matches 7 run data modify entity @s HandItems set value [{id:"stone_axe",Count:1b}, {}]
execute if score $random cc_item matches 8 run data modify entity @s HandItems set value [{id:"stone_hoe",Count:1b}, {}]
execute if score $random cc_item matches 9 run data modify entity @s HandItems set value [{id:"stone_sword",Count:1b}, {}]
execute if score $random cc_item matches 10 run data modify entity @s HandItems set value [{id:"oak_boat",Count:1b}, {}]
execute if score $random cc_item matches 11 run data modify entity @s HandItems set value [{id:"ladder",Count:1b}, {}]

tag @s remove not_ordered
tag @s add has_ordered
9 changes: 9 additions & 0 deletions data/chaotic_crafting/function/open_seat.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#tellraw @a {"text": "Opening Seats"}
execute as @s[tag=seat_1] run scoreboard players set $seat_1 cc_seats 0
execute as @s[tag=seat_2] run scoreboard players set $seat_2 cc_seats 0
execute as @s[tag=seat_3] run scoreboard players set $seat_3 cc_seats 0
execute as @s[tag=seat_4] run scoreboard players set $seat_4 cc_seats 0
execute as @s[tag=seat_5] run scoreboard players set $seat_5 cc_seats 0
execute as @s[tag=seat_6] run scoreboard players set $seat_6 cc_seats 0

scoreboard players set $bell_rang cc_customers 0
4 changes: 4 additions & 0 deletions data/chaotic_crafting/function/order_delivered.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
tag @p remove incorrect_item
tag @p add correct_item

kill @s
Loading

0 comments on commit 2db8929

Please sign in to comment.