Skip to content

Commit

Permalink
Keep only Eng coments to reduce lines count
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcarter11 committed Mar 15, 2022
1 parent 9a223af commit fbc00e7
Show file tree
Hide file tree
Showing 34 changed files with 89 additions and 192 deletions.
5 changes: 2 additions & 3 deletions Copyrights.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
Copyrights of the content of this folder:
- Creator & Developer: K-bai (minecraft name: K_bai)
- Developer: mattcarter11 (minecraft name: YouKnowWhen)
- XOR algorithm: xwjcool

All rights reserved.

Please, do not sell it, if sharing this datapack attribute the work to the team, and if possible add a link.

Current XOR algorithm is provided by xwjcool.
Please, do not sell it, if sharing this datapack attribute the work to the team, and if possible add a link.
14 changes: 5 additions & 9 deletions data/mrcd/functions/private/calculate/hashcode.mcfunction
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
# 函数参数: #var0, #var1
# var0-1: int值,xz坐标
# 返回值: #var0
# var0: 哈希值

# params: #var0, #var1
# var0-1: int value, x and z position
# return values: #var0
# var0: hashcode
# args: x and z position
# #var0 (int)
# #var1 (int)
# return: hashcode
# #var0 (int)

execute store result score #var_hc_x mrcd_system run scoreboard players get #var0 mrcd_system
execute store result score #var_hc_z mrcd_system run scoreboard players get #var1 mrcd_system
Expand Down
15 changes: 6 additions & 9 deletions data/mrcd/functions/private/calculate/offset.mcfunction
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# 函数参数: #var0, #var1
# var0-1: int值,xz坐标
# 返回值: #var0, #var1
# var0-1: int值,xz坐标偏移量

# params: #var0, #var1
# var0-1: int value, x and z position
# return values: #var0, #var1
# var0-1: int value, x and z position offset
# args: x and z position
# #var0 (int)
# #var1 (int)
# return: x and z position offset
# #var0 (int)
# #var1 (int)

function mrcd:private/calculate/hashcode
execute store result score #var_ofs_hc mrcd_system run scoreboard players get #var0 mrcd_system
Expand Down
23 changes: 6 additions & 17 deletions data/mrcd/functions/private/calculate/x.mcfunction
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
# 方程联立
## 直线方程 (x-x1)/x0=(y-y1)/y0=(z-z1)/z0
## 平面方程 x=#target_x
# 计算线面交点
## 若x0!=0
### 方程整理得 y=(#target_x-x1)y0/x0+y1
### 方程整理得 z=(#target_x-x1)z0/x0+z1
## 若x0=0,无交点

## Line equation: (x-x1)/x0=(y-y1)/y0=(z-z1)/z0
## Plane equation: x=#target_x
# Line equation: (x-x1)/x0 = (y-y1)/y0 = (z-z1)/z0
# Plane equation: x = #target_x
# Calculate the intersection point coordinate
## if x0!=0
### The equation can be arranged to: y=(#target_x-x1)y0/x0+y1
### The equation can be arranged to: z=(#target_x-x1)z0/x0+z1
## if x0=0, no intersection point

# if x0!=0
# The equation can be arranged to: y = (#target_x-x1)y0/x0+y1
# The equation can be arranged to: z = (#target_x-x1)z0/x0+z1
# if x0=0, no intersection point

# x


# y
execute store result score #target_y mrcd_system run scoreboard players get #target_x mrcd_system
scoreboard players operation #target_y mrcd_system -= #block_x mrcd_system
Expand Down
18 changes: 7 additions & 11 deletions data/mrcd/functions/private/calculate/xor.mcfunction
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# 函数参数: #var0, #var1
# var0-1: 被异或的两个Int32
# 返回值: #var0
# var0: Int32
# args:
# #var0 (int32)
# #var1 (int32)
# return:
# #var0 (int32)

# params: #var0, #var1
# var0-1: two Int32s used for XOR calculation
# return values: #var0
# var0: Int32

# 如果我先加再说呢? What if I do an addition first?
# What if I do an addition first?
scoreboard players operation #xor_result mrcd_system = #var0 mrcd_system
scoreboard players operation #xor_result mrcd_system += #var1 mrcd_system

# 检测并去除进位 detect and remove carried bits
# detect and remove carried bits
scoreboard players operation #var0 mrcd_system *= #n2 mrcd_system
scoreboard players operation #var1 mrcd_system *= #n2 mrcd_system
execute if score #var0 mrcd_system matches ..-1 if score #var1 mrcd_system matches ..-1 run scoreboard players operation #xor_result mrcd_system += #n2147483648 mrcd_system
Expand Down
22 changes: 6 additions & 16 deletions data/mrcd/functions/private/calculate/y.mcfunction
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
# 方程联立
## 直线方程 (x-x1)/x0=(y-y1)/y0=(z-z1)/z0
## 平面方程 y=#target_y
# 计算线面交点
## 若y0!=0
### 方程整理得 x=(#target_y-y1)x0/y0+x1
### 方程整理得 z=(#target_y-y1)z0/y0+z1
## 若y0=0,无交点

## Line equation: (x-x1)/x0=(y-y1)/y0=(z-z1)/z0
## Plane equation: y=#target_y
# Line equation: (x-x1)/x0 = (y-y1)/y0 = (z-z1)/z0
# Plane equation: y = #target_y
# Calculate the intersection point coordinate
## if y0!=0
### The equation can be arranged to: x=(#target_y-y1)x0/y0+x1
### The equation can be arranged to: z=(#target_y-y1)z0/y0+z1
## if y0=0, no intersection point

# if y0!=0
# The equation can be arranged to: x = (#target_y-y1)x0/y0+x1
# The equation can be arranged to: z = (#target_y-y1)z0/y0+z1
# if y0=0, no intersection point

# x
execute store result score #target_x mrcd_system run scoreboard players get #target_y mrcd_system
Expand Down
21 changes: 6 additions & 15 deletions data/mrcd/functions/private/calculate/z.mcfunction
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
# 方程联立
## 直线方程 (x-x1)/x0=(y-y1)/y0=(z-z1)/z0
## 平面方程 z=#target_z
# 计算线面交点
## 若z0!=0
### 方程整理得 x=(#target_z-z1)x0/z0+x1
### 方程整理得 y=(#target_z-z1)y0/z0+y1
## 若z0=0,无交点

## Line equation: (x-x1)/x0=(y-y1)/y0=(z-z1)/z0
## Plane equation: z=#target_z
# Line equation: (x-x1)/x0 = (y-y1)/y0 = (z-z1)/z0
# Plane equation: z = #target_z
# Calculate the intersection point coordinate
## if z0!=0
### The equation can be arranged to: x=(#target_z-z1)x0/z0+x1
### The equation can be arranged to: y=(#target_z-z1)y0/z0+y1
## if z0=0, no intersection point
# if z0!=0
# The equation can be arranged to: x = (#target_z-z1)x0/z0+x1
# The equation can be arranged to: y = (#target_z-z1)y0/z0+y1
# if z0=0, no intersection point



Expand Down
8 changes: 4 additions & 4 deletions data/mrcd/functions/private/complex_cube/convert.mcfunction
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# 寻找最近实体 Find the nearnest block marker
# Find the nearnest block marker
tag @e[tag=mrcd_touch_mark,sort=nearest,limit=1] add mrcd_temp
# 标记碰撞面 Copy the tag on the nearest block marker
# Copy the tag on the nearest block marker
execute if entity @e[tag=mrcd_temp,tag=mrcd_touch_x_plus] run tag @s add mrcd_touch_x_plus
execute if entity @e[tag=mrcd_temp,tag=mrcd_touch_x_minus] run tag @s add mrcd_touch_x_minus
execute if entity @e[tag=mrcd_temp,tag=mrcd_touch_y_plus] run tag @s add mrcd_touch_y_plus
execute if entity @e[tag=mrcd_temp,tag=mrcd_touch_y_minus] run tag @s add mrcd_touch_y_minus
execute if entity @e[tag=mrcd_temp,tag=mrcd_touch_z_plus] run tag @s add mrcd_touch_z_plus
execute if entity @e[tag=mrcd_temp,tag=mrcd_touch_z_minus] run tag @s add mrcd_touch_z_minus
# 获取目标在方块内的坐标 Get the position of the nearest block marker
# Get the position of the nearest block marker
execute store result score #target_x mrcd_system run data get entity @e[tag=mrcd_temp,limit=1] Pos[0] 1000
execute store result score #target_y mrcd_system run data get entity @e[tag=mrcd_temp,limit=1] Pos[1] 1000
execute store result score #target_z mrcd_system run data get entity @e[tag=mrcd_temp,limit=1] Pos[2] 1000
scoreboard players operation #target_x mrcd_system %= #const_1000 mrcd_system
scoreboard players operation #target_y mrcd_system %= #const_1000 mrcd_system
scoreboard players operation #target_z mrcd_system %= #const_1000 mrcd_system
# 删除标记 Kill all the block markers
# Kill all the block markers
kill @e[tag=mrcd_touch_mark]
1 change: 0 additions & 1 deletion data/mrcd/functions/private/complex_cube/main.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 根据朝向决定检测哪个面
# Choose a side to detect based on direction
execute unless entity @e[tag=mrcd_touch_cube_edge] if score @s mrcd_x0 matches 1.. if score #block_x mrcd_system <= #box_x0 mrcd_system run function mrcd:private/complex_cube/x0
execute unless entity @e[tag=mrcd_touch_cube_edge] if score @s mrcd_x0 matches ..-1 if score #block_x mrcd_system >= #box_x1 mrcd_system run function mrcd:private/complex_cube/x1
Expand Down
2 changes: 1 addition & 1 deletion data/mrcd/functions/private/complex_cube/move.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 移动到碰撞点 Move to #targetx,y,z
# Move to #targetx,y,z
scoreboard players operation #target_x mrcd_system += #block_corner_x mrcd_system
scoreboard players operation #target_y mrcd_system += #block_corner_y mrcd_system
scoreboard players operation #target_z mrcd_system += #block_corner_z mrcd_system
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/complex_cube/x0.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 x=#box_x0
## 相交条件 #box_y0<=y<=#box_y1 #box_z0<=z<=#box_z1

# Calculate the intersection point coordinate
## Plane equation: x=#box_x0
## Condition of crossing: #box_y0<=y<=#box_y1 #box_z0<=z<=#box_z1
# Plane equation: x = #box_x0
# Condition of crossing: #box_y0 <= y <= #box_y1 #box_z0 <= z <= #box_z1


execute store result score #target_x mrcd_system run scoreboard players get #box_x0 mrcd_system
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/complex_cube/x1.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 x=#box_x1
## 相交条件 #box_y0<=y<=#box_y1 #box_z0<=z<=#box_z1

# Calculate the intersection point coordinate
## Plane equation: x=#box_x1
## Condition of crossing: #box_y0<=y<=#box_y1 #box_z0<=z<=#box_z1
# Plane equation: x = #box_x1
# Condition of crossing: #box_y0 <= y <= #box_y1 #box_z0 <= z <= #box_z1


execute store result score #target_x mrcd_system run scoreboard players get #box_x1 mrcd_system
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/complex_cube/y0.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 y=#box_y0
## 相交条件 #box_x0<=x<=#box_x1 #box_z0<=z<=#box_z1

# Calculate the intersection point coordinate
## Plane equation: y=#box_y0
## Condition of crossing: #box_x0<=x<=#box_x1 #box_z0<=z<=#box_z1
# Plane equation: y = #box_y0
# Condition of crossing: #box_x0 <= x <= #box_x1 #box_z0 <= z <= #box_z1


execute store result score #target_y mrcd_system run scoreboard players get #box_y0 mrcd_system
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/complex_cube/y1.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 y=#box_y1
## 相交条件 #box_x0<=x<=#box_x1 #box_z0<=z<=#box_z1

# Calculate the intersection point coordinate
## Plane equation: y=#box_y1
## Condition of crossing: #box_x0<=x<=#box_x1 #box_z0<=z<=#box_z1
# Plane equation: y = #box_y1
# Condition of crossing: #box_x0 <= x <= #box_x1 #box_z0 <= z <= #box_z1


execute store result score #target_y mrcd_system run scoreboard players get #box_y1 mrcd_system
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/complex_cube/z0.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 z=#box_z0
## 相交条件 #box_x0<=x<=#box_x1 #box_y0<=y<=#box_y1

# Calculate the intersection point coordinate
## Plane equation: z=#box_z0
## Condition of crossing: #box_x0<=x<=#box_x1 #box_y0<=y<=#box_y1
# Plane equation: z = #box_z0
# Condition of crossing: #box_x0 <= x <= #box_x1 #box_y0 <= y <= #box_y1


execute store result score #target_z mrcd_system run scoreboard players get #box_z0 mrcd_system
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/complex_cube/z1.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 z=#box_z1
## 相交条件 #box_x0<=x<=#box_x1 #box_y0<=y<=#box_y1

# Calculate the intersection point coordinate
## Plane equation: z=#box_z1
## Condition of crossing: #box_x0<=x<=#box_x1 #box_y0<=y<=#box_y1
# Plane equation: z = #box_z1
# Condition of crossing: #box_x0 <= x <= #box_x1 #box_y0 <= y <= #box_y1


execute store result score #target_z mrcd_system run scoreboard players get #box_z1 mrcd_system
Expand Down
1 change: 0 additions & 1 deletion data/mrcd/functions/private/cube/main.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# 根据朝向决定检测哪个面
# Choose a side to detect based on direction
execute if score @s[tag=!mrcd_touch_edge] mrcd_x0 matches 1.. if score #block_x mrcd_system <= #box_x0 mrcd_system run function mrcd:private/cube/x0
tag @s[tag=mrcd_touch_x_minus] add mrcd_touch_edge
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/cube/x0.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 x=#box_x0
## 相交条件 #box_y0<=y<=#box_y1 #box_z0<=z<=#box_z1

# Calculate the intersection point coordinate
## Plane equation: x=#box_x0
## Condition of crossing: #box_y0<=y<=#box_y1 #box_z0<=z<=#box_z1
# Plane equation: x = #box_x0
# Condition of crossing: #box_y0 <= y <= #box_y1 #box_z0 <= z <= #box_z1

execute store result score #target_x mrcd_system run scoreboard players get #box_x0 mrcd_system
function mrcd:private/calculate/x
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/cube/x1.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 x=#box_x1
## 相交条件 #box_y0<=y<=#box_y1 #box_z0<=z<=#box_z1

# Calculate the intersection point coordinate
## Plane equation: x=#box_x1
## Condition of crossing: #box_y0<=y<=#box_y1 #box_z0<=z<=#box_z1
# Plane equation: x = #box_x1
# Condition of crossing: #box_y0 <= y <= #box_y1 #box_z0 <= z <= #box_z1

execute store result score #target_x mrcd_system run scoreboard players get #box_x1 mrcd_system
function mrcd:private/calculate/x
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/cube/y0.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 y=#box_y0
## 相交条件 #box_x0<=x<=#box_x1 #box_z0<=z<=#box_z1

# Calculate the intersection point coordinate
## Plane equation: y=#box_y0
## Condition of crossing: #box_x0<=x<=#box_x1 #box_z0<=z<=#box_z1
# Plane equation: y = #box_y0
# Condition of crossing: #box_x0 <= x <= #box_x1 #box_z0 <= z <= #box_z1

execute store result score #target_y mrcd_system run scoreboard players get #box_y0 mrcd_system
function mrcd:private/calculate/y
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/cube/y1.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 y=#box_y1
## 相交条件 #box_x0<=x<=#box_x1 #box_z0<=z<=#box_z1

# Calculate the intersection point coordinate
## Plane equation: y=#box_y1
## Condition of crossing: #box_x0<=x<=#box_x1 #box_z0<=z<=#box_z1
# Plane equation: y = #box_y1
# Condition of crossing: #box_x0 <= x <= #box_x1 #box_z0 <= z <= #box_z1


execute store result score #target_y mrcd_system run scoreboard players get #box_y1 mrcd_system
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/cube/z0.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 z=#box_z0
## 相交条件 #box_x0<=x<=#box_x1 #box_y0<=y<=#box_y1

# Calculate the intersection point coordinate
## Plane equation: z=#box_z0
## Condition of crossing: #box_x0<=x<=#box_x1 #box_y0<=y<=#box_y1
# Plane equation: z = #box_z0
# Condition of crossing: #box_x0 <= x <= #box_x1 #box_y0 <= y <= #box_y1


execute store result score #target_z mrcd_system run scoreboard players get #box_z0 mrcd_system
Expand Down
8 changes: 2 additions & 6 deletions data/mrcd/functions/private/cube/z1.mcfunction
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# 计算线面交点
## 平面方程 z=#box_z1
## 相交条件 #box_x0<=x<=#box_x1 #box_y0<=y<=#box_y1

# Calculate the intersection point coordinate
## Plane equation: z=#box_z1
## Condition of crossing: #box_x0<=x<=#box_x1 #box_y0<=y<=#box_y1
# Plane equation: z = #box_z1
# Condition of crossing: #box_x0 <= x <= #box_x1 #box_y0 <= y <= #box_y1


execute store result score #target_z mrcd_system run scoreboard players get #box_z1 mrcd_system
Expand Down
4 changes: 2 additions & 2 deletions data/mrcd/functions/private/entity.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 一条线实体检测 Test entities on the sight
# Test entities on the sight
execute at @s[tag=!mrcd_touch_entity] run function mrcd:private/entity_detect
execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^.2 run function mrcd:private/entity_detect
execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^.4 run function mrcd:private/entity_detect
Expand All @@ -10,7 +10,7 @@ execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^1.4 run function mrcd:priv
execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^1.6 run function mrcd:private/entity_detect
execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^1.7 run function mrcd:private/entity_detect

# 加tag Add tags
# Add tags
execute if entity @s[tag=mrcd_touch_entity] run tag @s add mrcd_touch_edge
tag @e[tag=mrcd_target_entity_temp] add mrcd_target_entity
tag @e[tag=mrcd_target_entity_temp] remove mrcd_target_entity_temp
2 changes: 1 addition & 1 deletion data/mrcd/functions/private/entity_detect.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 实体检测 Entity test
# Entity test
execute positioned ~-.05 ~-.05 ~-.05 if entity @e[type=!#mrcd:ignore,dx=0,dy=0,dz=0] positioned ~-.9 ~-.9 ~-.9 run tag @e[type=!#mrcd:ignore,dx=0,dy=0,dz=0] add mrcd_target_entity_temp
execute if entity @e[tag=mrcd_target_entity_temp] run tag @s add mrcd_touch_entity
#execute if entity @s[tag=mrcd_touch_entity] run tp @s ~ ~ ~
4 changes: 2 additions & 2 deletions data/mrcd/functions/private/entity_targeted.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 一条线实体检测 Test entities on the sight
# Test entities on the sight
execute at @s[tag=!mrcd_touch_entity] run function mrcd:private/entity_targeted_detect
execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^.2 run function mrcd:private/entity_targeted_detect
execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^.4 run function mrcd:private/entity_targeted_detect
Expand All @@ -10,7 +10,7 @@ execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^1.4 run function mrcd:priv
execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^1.6 run function mrcd:private/entity_targeted_detect
execute at @s[tag=!mrcd_touch_entity] positioned ^ ^ ^1.7 run function mrcd:private/entity_targeted_detect

# 加tag Add tags
# Add tags
execute if entity @s[tag=mrcd_touch_entity] run tag @s add mrcd_touch_edge
tag @e[tag=mrcd_target_entity_temp] add mrcd_target_entity
tag @e[tag=mrcd_target_entity_temp] remove mrcd_target_entity_temp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 实体检测 Entity test
# Entity test
execute positioned ~-.05 ~-.05 ~-.05 if entity @e[tag=mrcd_target,dx=0,dy=0,dz=0] positioned ~-.9 ~-.9 ~-.9 run tag @e[tag=mrcd_target,dx=0,dy=0,dz=0] add mrcd_target_entity_temp
execute if entity @e[tag=mrcd_target_entity_temp] run tag @s add mrcd_touch_entity
#execute if entity @s[tag=mrcd_touch_entity] run tp @s ~ ~ ~
Loading

0 comments on commit fbc00e7

Please sign in to comment.