Skip to content

Translation notice

This page was translated with machine translation and may contain inaccuracies. If you can help improve it, please open an issue or submit a pull request.

Second cover

You have entered a secret page!

Just kidding. During the update process of Vanilla Library, we found that there is no suitable place for storing some time-sensitive and detailed information in the library. Therefore, we plan to add a page in "feature" to put some miscellaneous information. Updated with the "feature" update. The content of this page is not fixed, it may be various information, such as command questions and answers, trivia, data pack jokes, etc. We have also added a discussion area for this journal at the bottom of this page. You can express your views on this issue of "Feature" below, and you can also ask us questions.

What's New in the Library?

TIP

This section posts new posts recently included in the library, replacing the original "Recent Updates" page.

Command Flashlight Command Flashlight

Eliminate the automatic coordinated attack behavior of wolves

As one of the entities that can actively follow the player, the wolf is very effective when making some following systems (such as automatically following robots). But we don't always want it to automatically attack skeletons or mobs that the player is attacking. Therefore we can modifyfollow_rangeto eliminate hostile behavior.

Use the specified wolf as the executor to execute the following commands frequently:

mcfunction
execute if data entity @s AngryAt run attribute @s follow_range modifier add anger -1 add_multiplied_total
 
execute unless data entity @s AngryAt run attribute @s follow_range modifier remove anger

This command works by lowering the wolf's aggro target by lowering itsfollow_rangeattributes to eliminate the hate target, and restore the attributes after the target is eliminated to retain its following and pathfinding capabilities.

Fast rough radiographic inspection

It only takes effect on the entity. The simulation emits a ray towards the entity at a certain position. The entity hit by the ray says you have discovered it. No recursion, good performance, average but acceptable accuracy

mcfunction
#raycast:
#uuid("62b8618f-a8d1-4d04-ab9b-1aa77123c442")
execute unless loaded ~ ~ ~ run return 0
summon marker ~ ~ ~ {UUID:[I;1656250767,-1462678268,-1415898457,1898169410]}
execute as 62b8618f-a8d1-4d04-ab9b-1aa77123c442 run function raycast/1
#raycast/1:
rotate @s ~ ~
function raycast/2
kill @s
#raycast/2:
execute \
as @e[tag=!raycast.ignore,type=!#你要忽略的实体,distance=..最远距离,sort=nearest] positioned ^ ^ ^最远距离 positioned as @s[distance=..最远距离+0.3] \
positioned ~ ~ ~2048 facing entity @s eyes positioned ^ ^ ^1024 positioned ~ ~ ~-1024 \
rotated as 62b8618f-a8d1-4d04-ab9b-1aa77123c442 positioned ^ ^ ^1024 facing entity 62b8618f-a8d1-4d04-ab9b-1aa77123c442 feet positioned ^ ^ ^1024 \
facing entity @s feet rotated ~ 0 positioned ^ ^ ^0.26 \
positioned ~-0.01 ~-0.01 ~-0.01 as @s[dx=0,dy=0,dz=0] positioned ~-0.98 ~-0.98 ~-0.98 at @s[dx=0,dy=0,dz=0] \
run return run say 被你发现了
#使用方法
#执行者为玩家
tag @s add raycast.ignore
execute anchored eyes positioned ^ ^ ^ run function raycast
tag @s remove raycast.ignore

MC explosion momentum calculation formula

Explosion intensity = 1-distance from explosion center to entity/explosion diameter Explosion momentum = unit vector from explosion center to entity eye * explosion intensity

Powered by VitePress and GitHub Pages