Skip to content

Commit

Permalink
Increase version
Browse files Browse the repository at this point in the history
  • Loading branch information
ICY105 committed Jul 14, 2024
1 parent 94050c9 commit a05d96c
Show file tree
Hide file tree
Showing 69 changed files with 127 additions and 132 deletions.
5 changes: 0 additions & 5 deletions data/energy/function/v1.7/cable/break_2.mcfunction

This file was deleted.

9 changes: 0 additions & 9 deletions data/energy/function/v1.7/cable/break_cable_2.mcfunction

This file was deleted.

5 changes: 0 additions & 5 deletions data/energy/function/v1.7/cable/update_2.mcfunction

This file was deleted.

5 changes: 0 additions & 5 deletions data/energy/function/v1.7/resolve.mcfunction

This file was deleted.

2 changes: 0 additions & 2 deletions data/energy/function/v1.7/versioning/break_cable.mcfunction

This file was deleted.

2 changes: 0 additions & 2 deletions data/energy/function/v1.7/versioning/break_machine.mcfunction

This file was deleted.

2 changes: 0 additions & 2 deletions data/energy/function/v1.7/versioning/init_cable.mcfunction

This file was deleted.

2 changes: 0 additions & 2 deletions data/energy/function/v1.7/versioning/init_machine.mcfunction

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ scoreboard players set @s energy.network_id 0

#up
scoreboard players set #cable.direction energy.data 0
execute align xyz positioned ~ ~1 ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/break_2
execute align xyz positioned ~ ~1 ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_2

#down
scoreboard players set #cable.direction energy.data 1
execute align xyz positioned ~ ~-1 ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/break_2
execute align xyz positioned ~ ~-1 ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_2

#north
scoreboard players set #cable.direction energy.data 2
execute align xyz positioned ~ ~ ~-1 as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/break_2
execute align xyz positioned ~ ~ ~-1 as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_2

#south
scoreboard players set #cable.direction energy.data 3
execute align xyz positioned ~ ~ ~1 as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/break_2
execute align xyz positioned ~ ~ ~1 as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_2

#east
scoreboard players set #cable.direction energy.data 4
execute align xyz positioned ~1 ~ ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/break_2
execute align xyz positioned ~1 ~ ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_2

#west
scoreboard players set #cable.direction energy.data 5
execute align xyz positioned ~-1 ~ ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/break_2
execute align xyz positioned ~-1 ~ ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_2

#update machine ids
scoreboard players operation #predicate energy.data = #cable.temp energy.data
execute as @e[type=#energy:valid_block_entities,tag=!energy.cable,predicate=energy:v1.7/has_network_id] at @s run function energy:v1.7/cable/break_reconnect
execute as @e[type=#energy:valid_block_entities,tag=!energy.cable,predicate=energy:v1.8/has_network_id] at @s run function energy:v1.8/cable/break_reconnect

#setup network transfer capacity
scoreboard players set @e[type=#energy:valid_block_entities,tag=energy.cable] energy.transfer_capacity -1
execute as @e[type=#energy:valid_block_entities,tag=energy.cable] at @s run function energy:v1.7/cable/setup_cable_network
execute as @e[type=#energy:valid_block_entities,tag=energy.cable] at @s run function energy:v1.8/cable/setup_cable_network
5 changes: 5 additions & 0 deletions data/energy/function/v1.8/cable/break_2.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#reroute to proper function
execute if entity @s[tag=energy.send] run function energy:v1.8/cable/break_machine
execute if entity @s[tag=energy.receive,tag=!energy.send] run function energy:v1.8/cable/break_machine
execute if entity @s[tag=energy.cable] run function energy:v1.8/cable/break_cable
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ function #energy:v1/cable_update
scoreboard players operation #predicate energy.data = @s energy.network_id
scoreboard players add #global.incr_id energy.network_id 1
scoreboard players operation #cable.network_id energy.data = #global.incr_id energy.network_id
function energy:v1.7/cable/break_cable_2
function energy:v1.8/cable/break_cable_2
9 changes: 9 additions & 0 deletions data/energy/function/v1.8/cable/break_cable_2.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

scoreboard players operation @s energy.network_id = #cable.network_id energy.data

execute align xyz positioned ~ ~01 ~ as @e[type=#energy:valid_block_entities,predicate=energy:v1.8/equals_network_id,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_cable_2
execute align xyz positioned ~ ~-1 ~ as @e[type=#energy:valid_block_entities,predicate=energy:v1.8/equals_network_id,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_cable_2
execute align xyz positioned ~ ~ ~-1 as @e[type=#energy:valid_block_entities,predicate=energy:v1.8/equals_network_id,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_cable_2
execute align xyz positioned ~ ~ ~01 as @e[type=#energy:valid_block_entities,predicate=energy:v1.8/equals_network_id,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_cable_2
execute align xyz positioned ~01 ~ ~ as @e[type=#energy:valid_block_entities,predicate=energy:v1.8/equals_network_id,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_cable_2
execute align xyz positioned ~-1 ~ ~ as @e[type=#energy:valid_block_entities,predicate=energy:v1.8/equals_network_id,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/break_cable_2
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ scoreboard players add @s energy.network_id 0

#get network id
scoreboard players set #cable.network_id energy.data 0
execute align xyz positioned ~ ~1 ~ as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/init_2
execute align xyz positioned ~ ~-1 ~ as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/init_2
execute align xyz positioned ~ ~ ~-1 as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/init_2
execute align xyz positioned ~ ~ ~1 as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/init_2
execute align xyz positioned ~1 ~ ~ as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/init_2
execute align xyz positioned ~-1 ~ ~ as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/init_2
execute align xyz positioned ~ ~1 ~ as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/init_2
execute align xyz positioned ~ ~-1 ~ as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/init_2
execute align xyz positioned ~ ~ ~-1 as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/init_2
execute align xyz positioned ~ ~ ~1 as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/init_2
execute align xyz positioned ~1 ~ ~ as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/init_2
execute align xyz positioned ~-1 ~ ~ as @e[type=#energy:valid_block_entities,tag=energy.cable,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/init_2

execute if score #cable.network_id energy.data matches 0 run scoreboard players add #global.incr_id energy.network_id 1
execute if score #cable.network_id energy.data matches 0 run scoreboard players operation #cable.network_id energy.data = #global.incr_id energy.network_id
scoreboard players operation @s energy.network_id = #cable.network_id energy.data

#call update function
function energy:v1.7/cable/update
function energy:v1.8/cable/update

#setup network transfer capacity
scoreboard players set @e[type=#energy:valid_block_entities,tag=energy.cable] energy.transfer_capacity -1
execute as @e[type=#energy:valid_block_entities,tag=energy.cable] at @s run function energy:v1.7/cable/setup_cable_network
execute as @e[type=#energy:valid_block_entities,tag=energy.cable] at @s run function energy:v1.8/cable/setup_cable_network
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

#if id is assigned, cascade across the entire network
execute if score #cable.network_id energy.data matches 1.. run scoreboard players operation #predicate energy.data = @s energy.network_id
execute if score #cable.network_id energy.data matches 1.. as @e[type=#energy:valid_block_entities,predicate=energy:v1.7/equals_network_id] run scoreboard players operation @s energy.network_id = #cable.network_id energy.data
execute if score #cable.network_id energy.data matches 1.. as @e[type=#energy:valid_block_entities,predicate=energy:v1.7/has_network_id] run function energy:v1.7/cable/init_machine
execute if score #cable.network_id energy.data matches 1.. as @e[type=#energy:valid_block_entities,predicate=energy:v1.8/equals_network_id] run scoreboard players operation @s energy.network_id = #cable.network_id energy.data
execute if score #cable.network_id energy.data matches 1.. as @e[type=#energy:valid_block_entities,predicate=energy:v1.8/has_network_id] run function energy:v1.8/cable/init_machine

#if id is unassigned, assign to current value
execute if score #cable.network_id energy.data matches 0 run scoreboard players operation #cable.network_id energy.data = @s energy.network_id

#call update function
function energy:v1.7/cable/update
function energy:v1.8/cable/update
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
#if defined transfer rate < current capacity, assign capacity as rate and cascade to entire network
execute unless score @s energy.transfer_capacity matches 0.. run scoreboard players set @s energy.transfer_capacity 2147483647
execute if score @s energy.transfer_rate < @s energy.transfer_capacity run scoreboard players operation #predicate energy.data = @s energy.network_id
execute if score @s energy.transfer_rate < @s energy.transfer_capacity run scoreboard players operation @e[type=#energy:valid_block_entities,tag=energy.cable,predicate=energy:v1.7/equals_network_id] energy.transfer_capacity = @s energy.transfer_rate
execute if score @s energy.transfer_rate < @s energy.transfer_capacity run scoreboard players operation @e[type=#energy:valid_block_entities,tag=energy.cable,predicate=energy:v1.8/equals_network_id] energy.transfer_capacity = @s energy.transfer_rate
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,27 @@ scoreboard players operation #cable.network_id energy.data = @s energy.network_i

#up
scoreboard players set #cable.direction energy.data 0
execute align xyz positioned ~ ~1 ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/update_2
execute align xyz positioned ~ ~1 ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/update_2

#down
scoreboard players set #cable.direction energy.data 1
execute align xyz positioned ~ ~-1 ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/update_2
execute align xyz positioned ~ ~-1 ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/update_2

#north
scoreboard players set #cable.direction energy.data 2
execute align xyz positioned ~ ~ ~-1 as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/update_2
execute align xyz positioned ~ ~ ~-1 as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/update_2

#south
scoreboard players set #cable.direction energy.data 3
execute align xyz positioned ~ ~ ~1 as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/update_2
execute align xyz positioned ~ ~ ~1 as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/update_2

#east
scoreboard players set #cable.direction energy.data 4
execute align xyz positioned ~1 ~ ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/update_2
execute align xyz positioned ~1 ~ ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/update_2

#west
scoreboard players set #cable.direction energy.data 5
execute align xyz positioned ~-1 ~ ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.7/cable/update_2
execute align xyz positioned ~-1 ~ ~ as @e[type=#energy:valid_block_entities,dx=0,dy=0,dz=0] at @s run function energy:v1.8/cable/update_2

# store values
scoreboard players operation @s energy.data = #cable.model_data energy.data
Expand Down
5 changes: 5 additions & 0 deletions data/energy/function/v1.8/cable/update_2.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

#reroute to proper function
execute if entity @s[tag=energy.send] run function energy:v1.8/cable/update_machine
execute if entity @s[tag=energy.receive,tag=!energy.send] run function energy:v1.8/cable/update_machine
execute if entity @s[tag=energy.cable] run function energy:v1.8/cable/update_cable
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#copy scores
scoreboard players operation #predicate energy.data = #energy.network_id energy.data
scoreboard players operation #energy.cable_rate energy.data = @s energy.transfer_rate
scoreboard players operation #energy.cable_rate energy.data = @e[type=#energy:valid_block_entities,tag=energy.cable,predicate=energy:v1.7/equals_network_id,limit=1] energy.transfer_capacity
scoreboard players operation #energy.cable_rate energy.data = @e[type=#energy:valid_block_entities,tag=energy.cable,predicate=energy:v1.8/equals_network_id,limit=1] energy.transfer_capacity

#collect power
scoreboard players set #energy.available energy.data 0
execute as @e[type=#energy:valid_block_entities,tag=energy.send,predicate=energy:v1.7/has_network_id,scores={energy.storage=1..}] run function energy:v1.7/energy/collect_energy_2
execute as @e[type=#energy:valid_block_entities,tag=energy.send,predicate=energy:v1.8/has_network_id,scores={energy.storage=1..}] run function energy:v1.8/energy/collect_energy_2
execute if score #energy.available energy.data > #energy.cable_rate energy.data run scoreboard players operation #energy.available energy.data = #energy.cable_rate energy.data
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ scoreboard players operation #predicate energy.data = #energy.network_id energy.

#collect power
scoreboard players set #energy.spent energy.data 0
execute if score #energy.spent energy.data < #energy.available energy.data if entity @s[tag=energy.receive] as @e[type=#energy:valid_block_entities,tag=energy.receive,tag=!energy.send,predicate=energy:v1.7/has_network_id] if score @s energy.storage < @s energy.max_storage run function energy:v1.7/energy/distribute_energy_2
execute if score #energy.spent energy.data < #energy.available energy.data if entity @s[tag=!energy.receive] as @e[type=#energy:valid_block_entities,tag=energy.receive,tag=!energy.send,predicate=energy:v1.7/has_network_id] if score @s energy.storage < @s energy.max_storage run function energy:v1.7/energy/distribute_energy_2
execute if score #energy.spent energy.data < #energy.available energy.data if entity @s[tag=!energy.receive] as @e[type=#energy:valid_block_entities,tag=energy.receive,tag=energy.send,predicate=energy:v1.7/has_network_id] if score @s energy.storage < @s energy.max_storage run function energy:v1.7/energy/distribute_energy_2
execute if score #energy.spent energy.data < #energy.available energy.data if entity @s[tag=energy.receive] as @e[type=#energy:valid_block_entities,tag=energy.receive,tag=!energy.send,predicate=energy:v1.8/has_network_id] if score @s energy.storage < @s energy.max_storage run function energy:v1.8/energy/distribute_energy_2
execute if score #energy.spent energy.data < #energy.available energy.data if entity @s[tag=!energy.receive] as @e[type=#energy:valid_block_entities,tag=energy.receive,tag=!energy.send,predicate=energy:v1.8/has_network_id] if score @s energy.storage < @s energy.max_storage run function energy:v1.8/energy/distribute_energy_2
execute if score #energy.spent energy.data < #energy.available energy.data if entity @s[tag=!energy.receive] as @e[type=#energy:valid_block_entities,tag=energy.receive,tag=energy.send,predicate=energy:v1.8/has_network_id] if score @s energy.storage < @s energy.max_storage run function energy:v1.8/energy/distribute_energy_2
Loading

0 comments on commit a05d96c

Please sign in to comment.