Skip to content

Commit

Permalink
Updated to v1.16.5.04
Browse files Browse the repository at this point in the history
- Players should now be able to sit on even more blocks without 'jumping up' first.
- Moved time-keeping scores to C.O.R.E tick registers. Should improve performance slightly.
- Fixed a bug where all players get unseated if any one player glitched
- Fixed a bug where players fail to sit sometimes when 'Only-If-Sneaking' is enabled
  • Loading branch information
x-2mas committed Feb 13, 2021
1 parent 3cffd91 commit 912ebf5
Show file tree
Hide file tree
Showing 50 changed files with 596 additions and 197 deletions.
@@ -0,0 +1,36 @@
#######
# Compiled from data/x_core/functions/__random_number.mcscript
# to .//Xmas Labs - C.O.R.E/data/x_core/functions/__random_number.mcfunction
#
# Generated by Minecraft Script for 1.16
######


# C.O.R.E | __random_number
# Recursing part of random number function


scoreboard players operation x_RNG x_R0 = x_RNG x_R2
scoreboard players operation x_RNG x_R0 -= x_RNG x_R1
execute if score x_RNG x_R0 matches ..0 run scoreboard players set x_CPU x_R3 -1
execute if score x_RNG x_R0 matches ..0 run scoreboard players operation x_RNG x_R0 = x_RNG x_R1

execute unless score x_CPU x_R3 matches ..-1 run scoreboard players set x_CPU x_R0 2
execute unless score x_CPU x_R3 matches ..-1 run scoreboard players operation x_RNG x_R0 /= x_CPU x_R0
execute unless score x_CPU x_R3 matches ..-1 run scoreboard players operation x_RNG x_R0 += x_RNG x_R1
execute unless score x_CPU x_R3 matches ..-1 run scoreboard players set x_CPU x_R3 1
execute unless score x_CPU x_R3 matches ..-1 unless score x_RNG x_R3 matches 0.. run scoreboard players set x_RNG x_R3 50
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 10 if predicate x_core:random_10 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 20 if predicate x_core:random_20 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 30 if predicate x_core:random_30 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 40 if predicate x_core:random_40 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 50 if predicate x_core:random_50 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 60 if predicate x_core:random_60 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 70 if predicate x_core:random_70 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 80 if predicate x_core:random_80 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_RNG x_R3 matches 90 if predicate x_core:random_90 run scoreboard players set x_CPU x_R3 2
execute unless score x_CPU x_R3 matches ..-1 if score x_CPU x_R3 matches 1 run scoreboard players operation x_RNG x_R2 = x_RNG x_R0
execute unless score x_CPU x_R3 matches ..-1 unless score x_CPU x_R3 matches 1 run scoreboard players operation x_RNG x_R1 = x_RNG x_R0
execute unless score x_CPU x_R3 matches ..-1 run function x_core:__random_number

scoreboard players reset x_CPU x_R3
16 changes: 16 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/functions/get_random.mcfunction
Expand Up @@ -9,3 +9,19 @@
# C.O.R.E | get_random
# Generates a random number and stores it in the x_RNG player unit


scoreboard players operation x_RNG x_R0 = x_RNG x_R2
scoreboard players operation x_RNG x_R0 -= x_RNG x_R1
execute if score x_RNG x_R0 matches ..0 run scoreboard players set x_RNG x_R3 -1
execute if score x_RNG x_R0 matches ..0 run scoreboard players operation x_RNG x_R0 = x_RNG x_R1

execute unless score x_RNG x_R3 matches ..-1 run scoreboard players set x_CPU x_R0 2
execute unless score x_RNG x_R3 matches ..-1 run scoreboard players operation x_RNG x_R0 /= x_CPU x_R0
execute unless score x_RNG x_R3 matches ..-1 run scoreboard players operation x_RNG x_R0 += x_RNG x_R1
execute unless score x_RNG x_R3 matches ..-1 run scoreboard players set x_RNG x_R3 1
execute unless score x_RNG x_R3 matches ..-1 if predicate x_core:random run scoreboard players set x_RNG x_R3 2
execute unless score x_RNG x_R3 matches ..-1 if score x_RNG x_R3 matches 1 run scoreboard players operation x_RNG x_R1 = x_RNG x_R0
execute unless score x_RNG x_R3 matches ..-1 unless score x_RNG x_R3 matches 1 run scoreboard players operation x_RNG x_R2 = x_RNG x_R0
execute unless score x_RNG x_R3 matches ..-1 run function x_core:get_random

scoreboard players reset x_RNG x_R3
82 changes: 38 additions & 44 deletions Xmas Labs - C.O.R.E/data/x_core/functions/load.mcfunction

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Xmas Labs - C.O.R.E/data/x_core/functions/main.mcfunction
Expand Up @@ -10,5 +10,6 @@
# Runs on every tick. About 20 times a second.


execute if data storage x_core packs{x_core:116503} run function x_core:runtime
execute unless data storage x_core packs{x_core:116503} run function x_core:uninstall
execute if data storage x_core packs{x_core:116505} run function x_core:runtime
execute unless data storage x_core packs{x_core:116505} run function x_core:uninstall
function x_core:test
18 changes: 18 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/functions/random_number.mcfunction
@@ -0,0 +1,18 @@
#######
# Compiled from data/x_core/functions/random_number.mcscript
# to .//Xmas Labs - C.O.R.E/data/x_core/functions/random_number.mcfunction
#
# Generated by Minecraft Script for 1.16
######


# C.O.R.E | random_number
# Generates a random number and stores it in the x_RNG player unit


execute if score x_RNG x_R1 > x_RNG x_R2 run scoreboard players operation x_CPU x_R0 = x_RNG x_R1
execute if score x_RNG x_R1 > x_RNG x_R2 run scoreboard players operation x_RNG x_R1 = x_RNG x_R2
execute if score x_RNG x_R1 > x_RNG x_R2 run scoreboard players operation x_RNG x_R2 = x_CPU x_R0

scoreboard players reset x_CPU x_R3
function x_core:__random_number
2 changes: 2 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/functions/runtime.mcfunction
Expand Up @@ -20,6 +20,8 @@ execute unless data storage x_core flags{loadCPU:0} if data storage x_core flags
execute unless data storage x_core flags{loadCPU:0} if data storage x_core flags.loadCPU unless data storage x_core flags{scrollBar:0} if data storage x_core flags.scrollBar unless data storage x_core flags{loadScrollBarRegisters:0} if data storage x_core flags.loadScrollBarRegisters run function x_core:scrollbar
execute unless data storage x_core flags{loadCPU:0} if data storage x_core flags.loadCPU unless data storage x_core flags{trackRotation:0} if data storage x_core flags.trackRotation unless data storage x_core flags{loadRotationRegisters:0} if data storage x_core flags.loadRotationRegisters run function x_core:rotation_tracking

execute unless data storage x_core flags{ticker:0} if data storage x_core flags.ticker unless data storage x_core flags{loadTickRegister:0} if data storage x_core flags.loadTickRegister run function x_core:ticker

execute unless data storage x_core flags{blockCollisions:0} if data storage x_core flags.blockCollisions unless data storage x_core flags{loadCollisionRegisters:0} if data storage x_core flags.loadCollisionRegisters run function x_core:collision_blocking

execute unless data storage x_core flags{monitorItems:0} if data storage x_core flags.monitorItems run function x_core:monitor_items
Expand Down
9 changes: 9 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/functions/test.mcfunction
@@ -0,0 +1,9 @@
#######
# Compiled from data/x_core/functions/test.mcscript
# to .//Xmas Labs - C.O.R.E/data/x_core/functions/test.mcfunction
#
# Generated by Minecraft Script for 1.16
######
scoreboard players set x_RNG x_R1 1
scoreboard players set x_RNG x_R2 100
function x_core:random_number
18 changes: 18 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/functions/ticker.mcfunction
@@ -0,0 +1,18 @@
#######
# Compiled from data/x_core/functions/ticker.mcscript
# to .//Xmas Labs - C.O.R.E/data/x_core/functions/ticker.mcfunction
#
# Generated by Minecraft Script for 1.16
######


# C.O.R.E | ticker
# Manage tickers.


execute if score x_CPU x_TICK matches 2147483647.. run scoreboard players set x_CPU x_TICK 0

execute if score x_CPU x_TICK matches ..2147483647 run scoreboard players add x_CPU x_TICK 1

execute as @e[scores={x_TICK=2147483647..}] at @s run scoreboard players set @s x_TICK 0
execute as @e[scores={x_TICK=..2147483647}] at @s run scoreboard players add @s x_TICK 1
Expand Up @@ -21,6 +21,7 @@ scoreboard objectives remove x_R3
scoreboard objectives remove x_EID__T
scoreboard objectives remove x_EID
scoreboard objectives remove x_PID
scoreboard objectives remove x_TICK
scoreboard objectives remove x_SEARCH_KEY
scoreboard objectives remove x_NO_COLLIDE__T
scoreboard objectives remove x_COLLISION_A__T
Expand Down
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_10.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.1
}
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_20.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.2
}
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_30.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.3
}
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_40.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.4
}
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_50.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.5
}
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_60.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.6
}
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_70.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.7
}
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_80.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.8
}
4 changes: 4 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/predicates/random_90.json
@@ -0,0 +1,4 @@
{
"condition":"random_chance",
"chance": 0.9
}
129 changes: 129 additions & 0 deletions Xmas Labs - C.O.R.E/data/x_core/scripts/__random_number.mcscript
@@ -0,0 +1,129 @@

#
#
# C.O.R.E | __random_number
# Recursing part of random number function
#
#



/// Get the difference between upper and lower limits
/scoreboard players operation x_RNG x_R0 = x_RNG x_R2
/scoreboard players operation x_RNG x_R0 -= x_RNG x_R1


/// If upper and lower limits are equal,
if('score x_RNG x_R0 matches ..0'){

/// Set control variable to break recursion
/scoreboard players set x_CPU x_R3 -1

/// Set lower limit as selected number
/scoreboard players operation x_RNG x_R0 = x_RNG x_R1
}


/// If control variable not set to break recursion,
if(!'score x_CPU x_R3 matches ..-1') {

/// Get mid-value from difference in upper and lower limits
/scoreboard players set x_CPU x_R0 2
/scoreboard players operation x_RNG x_R0 /= x_CPU x_R0
/scoreboard players operation x_RNG x_R0 += x_RNG x_R1

/// Set control variable to pick lower half
/scoreboard players set x_CPU x_R3 1


/// If weight is unset,
if(!'score x_RNG x_R3 matches 0..') {

/// Use 50%
/scoreboard players set x_RNG x_R3 50
}

/// If weight is 10% and 10% random check is true
if('score x_RNG x_R3 matches 10' && 'predicate x_core:random_10') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}

/// If weight is 20% and 20% random check is true
if('score x_RNG x_R3 matches 20' && 'predicate x_core:random_20') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}

/// If weight is 30% and 30% random check is true
if('score x_RNG x_R3 matches 30' && 'predicate x_core:random_30') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}

/// If weight is 40% and 40% random check is true
if('score x_RNG x_R3 matches 40' && 'predicate x_core:random_40') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}

/// If weight is 50% and 50% random check is true
if('score x_RNG x_R3 matches 50' && 'predicate x_core:random_50') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}

/// If weight is 60% and 60% random check is true
if('score x_RNG x_R3 matches 60' && 'predicate x_core:random_60') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}

/// If weight is 70% and 70% random check is true
if('score x_RNG x_R3 matches 70' && 'predicate x_core:random_70') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}

/// If weight is 80% and 80% random check is true
if('score x_RNG x_R3 matches 80' && 'predicate x_core:random_80') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}

/// If weight is 90% and 90% random check is true
if('score x_RNG x_R3 matches 90' && 'predicate x_core:random_90') {

/// Set control variable to pick upper half
/scoreboard players set x_CPU x_R3 2
}


/// If control variable set to lower half,
if('score x_CPU x_R3 matches 1') {

/// Set upper limit to mid-value
/scoreboard players operation x_RNG x_R2 = x_RNG x_R0

/// If control variable set to upper half,
} else {

/// Set lower limit to mid-value
/scoreboard players operation x_RNG x_R1 = x_RNG x_R0
}


/// Recurse
/function x_core:__random_number
}

/// Reset control variable
/scoreboard players reset x_CPU x_R3

0 comments on commit 912ebf5

Please sign in to comment.