Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Most commands can be generated by visiting websites like "MCStacker" or "GamerGeeks", Here are only the more complex commands.
- //========SITTING NPC========\\
- 1. Repeating command block: execute as @e[tag=toilet_npc] at @s run tp @s ~ ~ ~ facing entity @p[distance=..3]
- 2. Summon the Horse: summon horse ~ ~-1.5 ~ {Invulnerable:1b,Silent:1,NoAI:1b,NoGravity:1b,Rotation:[180.0f,0.0f],Tame:1b,SaddleItem:{id:"minecraft:saddle",Count:1b},Passengers:[{id:"mannequin",profile:"player",immovable:1b,Tags:["toilet_npc"]}]}
- 3. Deactivate the repeat command once you're happy with the mannequin's rotation, then run the command: effect give @e[type=horse] minecraft:invisibility infinite 1 true
- //========Walking NPC========\\
- 1. Summon the NPC: summon minecraft:mannequin x y z {Tags:[NPC_Path]} (REPLACE X Y Z WITH THE INTENDED LOCATION)
- 2. Make it walk: execute at @e[tag=NPC_Path] as @e[tag=NPC_Path] if block ~ ~-2 ~ minecraft:lime_concrete run tp @e[tag=NPC_Path] ~ ~ ~.1 0 0
- 3. execute at @e[tag=NPC_Path] as @e[tag=NPC_Path] if block ~ ~-2 ~ minecraft:blue_concrete run tp @e[tag=NPC_Path] ~-.1 ~ ~ 90 0
- 4. execute at @e[tag=NPC_Path] as @e[tag=NPC_Path] if block ~ ~-2 ~ minecraft:red_concrete run tp @e[tag=NPC_Path] ~ ~ ~-.1 180 0
- 5. execute at @e[tag=NPC_Path] as @e[tag=NPC_Path] if block ~ ~-2 ~ minecraft:yellow_concrete run tp @e[tag=NPC_Path] ~.1 ~ ~ 270 0
- (YOU CAN CHANGE THE BLOCKS, TAGS, SPEED, ROTATION, LOCATION TO ANYTHING YOU WISH FOR.)
- To make it crouch: summon minecraft:mannequin x y z {Tags:[NPC_Sneak],pose:crouching} (You can change the tag, pose, or anything else. To make it move, use the same commands as above — just adjust the speed. For example, change 0.1 to 0.05 for slower movement.)
- //========Make an NPC look at you========\\
- 1. Repeater: execute as @e[tag=NPC_Look] at @s if entity @p[distance=..5] facing entity @p feet run tp @s ~ ~ ~ ~ ~ (Make sure to summon an NPC with a tag, You should know how by now, based on the earlier examples :D, you can also change the distance, or not mention it at all, if you want all mannequins to look at you, replace [tag=NPC_Look] with [type=mannequin])
- //========Make it follow you========\\
- 1. Make it follow you ONLY when it has a specific block below it: execute as @e[tag=NPC_Follow] at @s if block ~ ~-2 ~ minecraft:lime_concrete if entity @p[distance=..5] facing entity @p feet run tp @s ^ ^ ^0.1 ~ ~
- 2. Stop it from following you once the block below it changes (Also prevents it from getting stuck, usually): execute as @e[tag=NPC_Follow] at @s unless block ~ ~-2 ~ minecraft:lime_concrete run tp @s ^ ^ ^-0.05
- //========Copy Hands (Accurate)========\\
- 1. Summon NPC, with two tags: /summon minecraft:mannequin ~ ~2 ~ {Tags:[npc_items_main,npc_items_off],Rotation:[180f,0f]}
- 2. 2 Repeaters (Copy):
- Main hand: execute as @e[tag=npc_items_main] run data modify entity @s equipment.mainhand set from entity @p SelectedItem
- Off hand: execute as @e[tag=npc_items_off] run data modify entity @s equipment.offhand set from entity @p equipment.offhand
- 3. 2 Repeaters (Remove):
- Main hand: execute as @e[tag=npc_items_main] at @s unless data entity @p SelectedItem run data modify entity @s equipment.mainhand set value {id:"minecraft:air",Count:1b}
- Off hand: execute as @e[tag=npc_items_off] at @s unless data entity @p equipment.offhand run data modify entity @s equipment.offhand set value {id:"minecraft:air",Count:1b}
- //========Copy Armor (Accurate)========\\
- 1. 4 Repeaters (Copy): execute as @e[tag=npc_gear] run data modify entity @s equipment.head set from entity @p equipment.head
- 2. 4 Repeaters (Remove): execute as @e[tag=npc_gear] at @s unless data entity @p equipment.head.id run data remove entity @s equipment.head
- // Repeat for chestplate, leggings, boots by replacing:
- head → chest
- head → legs
- head → feet
- //======== Dynamic Poses ========\\
- 1. Place an Impulse Command Block with a simple Redstone Clock: execute as @e[tag=npc_pose] run data modify entity @s pose set value "crouching"
- You can use up to 5 different poses:
- 1 - crouching
- 2 - standing
- 3 - swimming
- 4 - sleeping
- 5 - fall_flying
- Each pose needs its own command block, cycle through them using a redstone clock for dynamic animation effects.
- //========Hostile NPC========\\
- ALL COMMANDS ARE SET TO REPEAT
- 1. gives NPC the tag: execute as @e[type=minecraft:mannequin,tag=attacker,tag=!active] at @s if entity @p[distance=..5] run tag @s add active
- 2. Face the player: execute as @e[type=minecraft:mannequin,tag=attacker,tag=active] at @s run tp @s ^ ^ ^0 facing entity @p
- 3. Walk towards the player: execute as @e[type=minecraft:mannequin,tag=attacker,tag=active] at @s run tp @s ^ ^ ^0.1
- 4. Attack: execute as @e[type=minecraft:mannequin,tag=attacker,tag=active] at @s if entity @p[distance=..1] run damage @p 2
- 5. (Optional), play a sound: execute as @e[type=minecraft:mannequin,tag=attacker,tag=active] at @s if entity @p[distance=..1] run playsound minecraft:entity.villager.no master @p ~ ~ ~ 1 1
- 6. Stop attacking if out of range: execute as @e[type=minecraft:mannequin,tag=attacker,tag=active] at @s unless entity @p[distance=..6] run tag @s remove active
- //======== NPC vs NPC ========\\
- 1. Summon two NPCs with different tags (example: "red" and "blue")
- /summon minecraft:mannequin ~ ~ ~ {Tags:["red"]}
- /summon minecraft:mannequin ~ ~ ~ {Tags:["blue"]}
- 2. Set up scoreboards
- /scoreboard objectives add isFighting dummy
- /scoreboard objectives add fightTimer dummy
- ALL COMMANDS BELOW SHOULD BE IN REPEATING COMMAND BLOCKS
- 3. Detect active fight
- execute as @e[tag=blue] if entity @e[tag=red] run scoreboard players set @s isFighting 1
- execute as @e[tag=red] if entity @e[tag=blue] run scoreboard players set @s isFighting 1
- 4. Clear fight flag if opponent is dead or missing
- execute as @e[tag=blue] unless entity @e[tag=red] run scoreboard players set @s isFighting 0
- execute as @e[tag=red] unless entity @e[tag=blue] run scoreboard players set @s isFighting 0
- 5. Face opponent while fighting
- execute as @e[tag=blue,scores={isFighting=1}] at @s run tp @s ^ ^ ^0 facing entity @e[tag=red,limit=1]
- execute as @e[tag=red,scores={isFighting=1}] at @s run tp @s ^ ^ ^0 facing entity @e[tag=blue,limit=1]
- 6. Move forward (simulate combat)
- execute as @e[tag=blue,scores={isFighting=1}] at @s run tp @s ^ ^ ^0.1
- execute as @e[tag=red,scores={isFighting=1}] at @s run tp @s ^ ^ ^0.1
- 7. Deal damage if in range
- execute as @e[tag=blue,scores={isFighting=1}] at @s if entity @e[tag=red,distance=..1] run damage @e[tag=red,limit=1,distance=..1] 2
- execute as @e[tag=red,scores={isFighting=1}] at @s if entity @e[tag=blue,distance=..1] run damage @e[tag=blue,limit=1,distance=..1] 2
- 8. Start post-fight timer (after fight ends)
- execute as @e[scores={isFighting=0..0}] run scoreboard players add @s fightTimer 1
- 9. Kill winner after 60 ticks (Optional cleanup)
- execute as @e[scores={fightTimer=60..}] run kill @s
- //======== Motion Capture (Sneaking Detection) ========\\
- 1. Copy player's rotation (Repeat Command Block)
- execute as @e[tag=MotionCap] run data modify entity @s Rotation set from entity @p Rotation
- 2. Setup scoreboard to detect sneaking
- /scoreboard objectives add sneaking minecraft.custom:minecraft.sneak_time
- 3. Sneak Detector Logic (Use SAME x y z for all)
- REPEAT: Reset block every tick (clears old state)
- setblock x y z air
- CHAIN 1: If player is sneaking, place a visible flag block
- execute as @a[scores={sneaking=1..}] at @s run setblock x y z minecraft:redstone_lamp[lit=true]
- CHAIN 2: NPC crouches if the redstone lamp exists
- execute as @e[tag=MotionCap] at @s if block x y z minecraft:redstone_lamp[lit=true] run data modify entity @s pose set value "crouching"
- CHAIN 3: NPC stands if redstone lamp is NOT there
- execute as @e[tag=MotionCap] at @s unless block x y z minecraft:redstone_lamp[lit=true] run data modify entity @s pose set value "standing"
- CHAIN 4: Reset the sneaking score after each tick
- scoreboard players reset @p sneaking
Add Comment
Please, Sign In to add comment