Skip to content

增加一个大数圆规检测实现上下左右的实体数量的宏函数 - #146

Open
bot0201 wants to merge 6 commits into
TouchController:mainfrom
bot0201:main
Open

bot0201 wants to merge 6 commits into
TouchController:mainfrom
bot0201:main

Conversation

@bot0201

@bot0201 bot0201 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

没啥好写的了bro

Added validation checks for side parameter and implemented entity counting logic for left, right, up, and down directions.
@bot0201

bot0201 commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

气笑了提示忘记改了

@WhiteElephant-abc

Copy link
Copy Markdown
Member
execute \ 
   if score #lib_get_side_entities_side tmp matches 0 \ 
   rotated as @s \ 
   positioned ^ ^1024 ^ \ 
   store result score @s entities_side \ 
   if entity @e[distance=0..1024]

我没看错的话,这段内容原样重复了4次?

@WhiteElephant-abc

WhiteElephant-abc commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

哦并不是
是条件一样

4条都是if score #lib_get_side_entities_side tmp matches 0吗

@WhiteElephant-abc

WhiteElephant-abc commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

其实也可以选择建一个文件夹,公共部分放一个宏函数
然后分别创建4个函数,调用它,能省去一个记分板,同时增强兼容性(没有宏函数的版本也能用)

为什么没有宏函数的版本能用,这个仓库的构建系统会内联不涉及execute run function的宏函数调用,所以还真能兼容

不过如果你用到的语法本就不适用于1.20.1甚至更低版本,那也无所谓了

@bot0201

bot0201 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

这样子可能不太好搞
可以试试看

@bot0201

bot0201 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

那个计分板其实不是tmp
是我自己本地写的没有改

@bot0201
bot0201 marked this pull request as draft October 7, 2026 05:47
@bot0201

bot0201 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

我先把tmp改回来

@bot0201
bot0201 marked this pull request as ready for review October 7, 2026 07:57
@bot0201

bot0201 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

如果真要再给这个文件重构一次就只是分出4个文件来
语法兼容性问题没怎么考虑(我主要写的是1.21.11的数据包)

@bot0201

bot0201 commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

另外这个函数是算入执行实体自身的,需要使用scoreboard players remove @s entities_side 1来剔除自身(可选,所以此文件没有写)

@WhiteElephant-abc

Copy link
Copy Markdown
Member

我想问一下(并非质疑)
为什么是基于视角的偏移,而不是位置
为什么没有前后

@bot0201

bot0201 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

基于视角偏移是我认为的基础功能
主要可以用于多边形填充以及沉浸式传送门(多人会出bug)

虽然视频里讲的是基岩版新版execute,但是此文件和这个的原理是一样的

@bot0201

bot0201 commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

前后确实是没写

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants