こんにちは
コマンドは上からコピーしていってね。
このコマンドを使えば右クリックでなんでもできます
コマンドブロックに書くコマンド
team add invisible
team modify invisible collisionRule never
team join invisible @a
team join invisible @e[tag=clickA]
effect give @e[tag=clickA] invisibility 1 1 true
team modify invisible seeFriendlyInvisibles false
execute as @e[type=villager,tag=click] at @s run stopsound @s player minecraft:entity.villager.no
tag @a[nbt={SelectedItem:{id:”minecraft:diamond_hoe”,Count:1b}},nbt={SelectedItem:{tag:{display:{Name:”{“text”:”マシンガン”}”}}}}] add gun
execute as @e[tag=gun] at @s[scores={shot=1..}] run summon armor_stand ~ ~ ~ {Tags:[“bullet”],Invisible:1,NoGravity:1,Marker:1}
execute as @a[tag=gun] at @s[scores={shot=1..}] run tp @e[tag=bullet,distance=..1,sort=nearest,limit=1] ^ ^ ^-0.02 facing entity @s
execute as @e[tag=bullet] at @s run tp @s ^ ^ ^1
execute as @a[tag=gun] at @s[scores={shot=1..}] run playsound minecraft:entity.blaze.shoot player @s
execute as @e[tag=bullet] at @s run kill @e[type=!player,type=!villager,type=!armor_stand,type=!item,distance=..1,sort=nearest,limit=1]
execute as @a[tag=!gun] at @s run scoreboard players set @s hand 0
execute as @a[tag=gun] at @s run scoreboard players add @s hand 1
execute as @a[tag=gun] at @s[scores={hand=1..1}] run summon villager ~ ~ ~ {OnGround:1b,NoGravity:1b,Silent:1b,Invulnerable:1b,Tags:[“clickA”],VillagerData:{level:1,profession:”minecraft:armorer”,type:”minecraft:desert”},Offers:{}}
execute as @a[tag=gun] at @s[scores={hand=1..1}] run summon villager ~ ~ ~ {OnGround:1b,NoGravity:1b,Silent:1b,Invulnerable:1b,Tags:[“clickB”],VillagerData:{level:1,profession:”minecraft:armorer”,type:”minecraft:desert”},Offers:{}}
team join invisible @e[tag=clickB]
effect give @e[tag=clickB] invisibility 1 1 true
execute as @a[tag=!gun] at @s run scoreboard players add @s unhand 1
execute as @a[tag=!gun] at @s[scores={unhand=1..1}] run tp @e[tag=clickA,sort=nearest,limit=1,distance=..3] ~ ~-100 ~
execute as @a[tag=!gun] at @s[scores={unhand=1..1}] run tp @e[tag=clickB,sort=nearest,limit=1] ~ ~-100 ~
execute as @a[tag=!gun] at @s[scores={unhand=1..}] run scoreboard players reset @s hand
execute as @a[tag=gun] at @s[scores={hand=1..}] run scoreboard players reset @s unhand
scoreboard players reset @a shot
execute as @a[tag=gun] at @s run tp @e[type=villager,tag=clickA,sort=nearest,limit=1] ^0.2 ^ ^0.4
execute as @a[tag=gun] at @s run tp @e[type=villager,tag=clickB,sort=nearest,limit=1] ^-0.2 ^ ^0.4
tag @a remove gun
execute as @e[tag=bullet] at @s run particle minecraft:firework ~ ~1 ~ 0 0 0 0 2 normal
execute as @e[tag=bullet] at @s run scoreboard players add @s shot_time 1
execute as @e[tag=bullet] at @s[scores={shot_time=1..}] run kill @s
scoreboard objectives add shot minecraft.custom:minecraft.talked_to_villager
scoreboard objectives add shot_time dummy
scoreboard objectives add hand dummy
scoreboard objectives add unhand dummy
gamerule commandBlockOutput false
武器を出すコマンド
give @p minecraft:diamond_hoe{display:{Name:”{“text”:”マシンガン”}”,Lore:[“右クリックで発射”]},HideFlags:59,Unbreakable:1b,Enchantments:[{id:”minecraft:unbreaking”,lvl:1}],AttributeModifiers:[{AttributeName:”generic.movementSpeed”,Name:”generic.movementSpeed”,Amount:-0.06,Operation:0,UUIDLeast:840978,UUIDMost:898173}]} 1
もしできなかったら行ってください
訂正します