что делает команда execute в майнкрафт

Cmd-Block Tutorial: /execute

Advanced Tutorial on the /execute command

So here is a blog on command blocks to demonstrate ways to use and possible uses of the /execute command, one of the most important commands, if not THE most important, used mainly by cmd blocks.

I will make this demonstation through a series of examples and possible combinations with other commands, so if you don’t have the very very basic knowledge and understanding of command blocks and their commands, this tutorial is not for you. :/

In my examples I will mostly use the «set and destroy» clock, one of the fastest clocks in minecraft. (if you don’t know which one I’m talking about, it’s okay. any really fast clock will do) Take as granted that any command I talk about is executed through a command block that is connected on that clock unless I state otherwise.

Target entity is any entity that can be targeted through the selectors given.

A slot activated command is a command that is activated as soon as a specific hotbar slot is selected. It is one of the best ways to manually execute a command.

/execute @e[selectors for target entity]

COMMAND
The command itself. It executes a command at the location of the target entity. It’s like the command block teleports for a brief moment and executes the COMMAND at a

location from the target.

Chain Targeting / Multi-Path Targeting

.1 /execute @e[selectors for main target entite]

execute @e[selectors for final target entity]

.2 /execute @e[selectors for first target entity]

execute @e[selectors for second target entity]

Command 1 is pretty simple. Instead of executing a command at the location of the main target entity, it executes a command at the final target entity that is located thanks to the main target entity. For instance, you can execute a command on all pigs within a certain radious from any sheep.

Command 2 executes a command at the location of the final target entity. I think this one’s use is better explained with an example:
Let’s say you have a «Protector» team and players in that team can protect villagers from zombies by dealing damage to them depending on how many zombies are gathered around the villager:

/execute @a[team=protector,and a selector that finds the player who activated the ability]

effect @e[type=Zombie,r=5] 7 1 0

This is a slot activated command btw, otherwise it would be really OP. What it does is locate all villagers within 10 blocks from the player who activated the ability, then locate all the zombies in a 5 block radious from each villager, then from each zombie locate the nearest villager in a 5 block radious and then for each different path created this way deal 6 damage to each zombie in a 5 block radious. So, if there is one villager and 3 zombies around him, the command will execute a command at each zombie that will execute the command /effect at the location of the villager for every time it was executed, which is 3 times.

objectives needed:
name: cont, critiria: dummy, starting value: 0

.1 /execute @e[score_cont_min=1]

scoreboard players set @e[r=X] cont 1
.2 /execute @e[score_cont_min=1]

Pretty simple, too. Let’s say there is at least 1 entity in the world that has a score of 1 for cont. All entities within a X block radious from that entity have their cont objective set to 1, too, thanks to command 1. Then, command 2 executes a command at the location of ALL affected entities (entities with a cont score=1).

The second command can be executed either at every tick, or be manually activated. For instance, at every tick it can give Weakness 5 and Wither 2 for 1 second to the affected entities, which is like a real, fatal desease, right? As soon as it is cured, after a short delay of 1 sec, the effects will go away.

Testfor for Selectors Alternative

.1 /execute @e[selectors]

execute @e[selectors for target entity]

«execute @e[selectors for target entity]» can be excluded if the entity we want to execute the command at is the same as the entity we are testing, or is a fixed to the world effect, such as «setblock x y z».

Yes, I know it is just the simple version of the chain targeting, but has a more specific use. And it also follows some rules. And it is better used as manually or only-once activated.
1. The selectors for target entity will always find an entity.
2. The other selectors may or may not be able to locate an entity (e.g. can be a score value, or it must be within a certain radious)
The main idea here is that the COMMAND is executed only when the first group of selectors can locate an entity. Otherwise, nothing happens.
For example, you can spawn particles above your head every time a cow is within 5 blocks. Or, if a player has scored 10 kills, spawn fireworks at a certain location.

Individual Global Operations

objectives needed:
name: doh, critiria: dummy, starting value: any
name: meh, critiria: any, starting value: 0

Command 1 calculates stuff based on the values meh takes over time. E.g. meh is the damage dealt by players and the operation is += which is addition. doh shows the total damage each player has dealt separately.

Various Qui ck Commands

Tests if the block beneath the entity is the one given in tilename.

kill @e[r=X,rm=1]
Kill everything within X blocks from the target entity.

.1 /execute @e[type=Pig,score_expsh_min=1]

xp 10 @p[r=X]
.2 /execute @a

That’s all for now. I will update this list with more stuff as soon as I have more time and ideas.
If you have a question / idea / suggestion leave a comment. C:

Источник

minecraft execute command | Tutorial | Commands #1

say exp
How to specify players/entities:
There are 2 ways you can specify the executor. 1st behind the @a/@p/@e/@r in square brackets. 2nd you can make a «addon-command», named detect. It is something like a testforblock. It detects a blocks from the position of the executor and only if this it true, then the command after execute WILL be executed.
Way 1:
/execute @a[m=1]

The command will be executed from every player in the mode 1 (gamemode: creative).
some other testfors:
r= radius
lm= min. level
team= scoreboard team
type= mobtype (just type in entity spawn name)
name= name of mob/player
rm= min. distance to executor
.
Way 2:
/execute @a

diamond_block 0 setspawn @p

The second way is more testing for blocks. This command tests, if a player is standing on a diamond block, and if one do, he’ll get a checkpoint on the block. Because the execute command defines the player, who is executing, you can set @p in the 2nd command, because the player, who is executing, will be the nearest player.

Lets put both together:
Lets make a highspeedclock. connect this command block to the clock: execute @a[lm=10l]

diamond_block 0 setspawn @p
Now make a comparator coming out from this block going into this one: execute @a[lm=10l]

Hope you learned a bit, maybe you now know how to let people say something, what they didn’t say.
PS: It’s execute [playername]

Источник

Minecraft Wiki

Из-за новой политики Microsoft в отношении сторонних ресурсов, Minecraft Wiki больше не является официальной. В связи с этим были внесены некоторые изменения, в том числе и обновлён логотип вики-проекта. Подробности на нашем Discord-сервере.

Команды консоли/structure

Используется для сохранения и загрузки структур без использования структурного блока.

structure save [saveMode: StructureSaveMode] structure save [includesEntites: Boolean] [saveMode: StructureSaveMode] Сохраняет структуру. structure load [rotation: Rotation] [mirror: Mirror] [includesEntites: Boolean] [includesBlocks: Boolean] [integriy: float] [seed: string] structure load [rotation: Rotation] [mirror: Mirror] [animationMode: StructureAnimationMode] [animationSeconds: float] [includesEntites: Boolean] [includesBlocks: Boolean] [integrity: float] [seed: string] Загружает структуру. structure delete Удаляет сохранённую структуру из списка

name: string : basic_string

from: x y z : CommandPosition и to: x y z : CommandPosition (в режиме save ).

Задаёт два противоположных угловых блока сохраняемой области.

to: x y z : CommandPosition (в режиме load ).

Задаёт нижний северо-западный угол выделенной области.

includesEntities: Boolean : bool

animationSeconds: float : float

Определяет продолжительность анимации.

includesBlocks: Boolean : bool

integriy: float : float

seed: string : basic_string

Указывает начальное число при вычислении того, должен ли блок загружаться в соответствии с целым. Если не указано, случайное начальное число является знаком.

Не выполняется, если неверно указаны аргументы. Не выполняется, если выделенные области не загружены или находятся за пределами мира. Не выполняется, если структура больше допустимого значения 64 × 256 × 64. Не выполняется, если указанной структуры не существует. В случае успеха сохраняет или загружает заданную область.

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *