311: Controlling a wandering trader. [Minecraft Map Making]

Subscribers:
3,570
Published on ● Video Link: https://www.youtube.com/watch?v=VzLveIN51c4



Minecraft
Game:
Minecraft (2011)
Duration: 30:57
491 views
17


Ep311: Various ways to change a wandering trader's wander target.

Version: 1.19

As used in episode 300 - Playing fetch with a fox:    • 300: Playing fetch with a fox. Experi...  

Commands, builds and ideas for people making their own Minecraft maps.

Check out my collabs on Coppit's channel:    / coppitj  

Join the CoppitCraft server that I play on and the Discord where I hang out.
Server IP: 51.81.246.145:25588
Discord:   / discord  

The following commands are prefixed with three letters which represent the settings of the command block. E.g IUN: = Impulse Unconditional Needs_Redstone. These prefixes need to be removed if copying the commands.

Since angled brackets are not allowed in YouTube descriptions you will have to replace "greater than" with the appropriate angled bracket. Ascii code: 62

Commands used:

Setup:
IUN: scoreboard objectives add temp_value dummy
CUA: scoreboard objectives add location_id dummy
CUA: scoreboard objectives add location_updated dummy

Summon:
IUN: summon wandering_trader ~ ~ ~4 {Tags:["myTrader"]}

Set directly:
IUN: execute as @e[tag=myTrader] run data modify entity @s WanderTarget.X set value 14
CUA: execute as @e[tag=myTrader] run data modify entity @s WanderTarget.Y set value 56
CUA: execute as @e[tag=myTrader] run data modify entity @s WanderTarget.Z set value 373

Set from storage:
IUN: data modify storage trader:data WanderTarget set value {X:14, Y:56, Z:373}
CUA: execute as @e[tag=myTrader] run data modify entity @s WanderTarget set from storage trader:data WanderTarget

Clear storage:
IUN: data remove storage trader:data WanderTarget

Save entity pos to storage:
IUN: data modify storage trader:data WanderTarget.X set from entity @e[limit=1,type=item, sort=nearest] Pos.X
CUA: data modify storage trader:data WanderTarget.Y set from entity @e[limit=1,type=item, sort=nearest] Pos.Y
CUA: data modify storage trader:data WanderTarget.Z set from entity @e[limit=1,type=item, sort=nearest] Pos.Z
CUA: execute as @e[tag=myTrader] run data modify entity @s WanderTarget set from storage trader:data WanderTarget

Change storage element:
IUN: data modify storage trader:data WanderTarget.X set value 380
CUA: execute as @e[tag=myTrader] run data modify entity @s WanderTarget set from storage trader:data WanderTarget

Increment storage element:
IUN: execute store result score #pos temp_value run data get storage trader:data WanderTarget.X
CUA: scoreboard players add #pos temp_value 10
CUA: execute store result storage trader:data WanderTarget.X int 1 run scoreboard players get #pos temp_value
CUA: execute as @e[tag=myTrader] run data modify entity @s WanderTarget set from storage trader:data WanderTarget

Execute if trader has no target:
RUA: execute as @e[tag=myTrader, nbt=!{WanderTarget:{}}] run say No target!

Execute if trader has a target:
RUA: execute as @e[tag=myTrader, nbt={WanderTarget:{}}] run say I have a target!

Set location array:
data modify storage trader:data WanderTarget set value [{X:14, Y:56, Z:373},{X:14, Y:56, Z:383},{X:24, Y:56, Z:383}]

Set location ID:
IUN: scoreboard players set @e[tag=myTrader] location_id 0

Give trader locations in sequence:
RUA: execute as @e[tag=myTrader, nbt=!{WanderTarget:{}}] run tag @s add no_target
CUA: execute as @e[tag=no_target, scores={location_id=0}] store success score @s location_updated run data modify entity @s WanderTarget set from storage trader:data WanderTarget[0]
CCA: scoreboard players add @e[tag=myTrader] location_id 1
CUA: execute as @e[tag=no_target, scores={location_id=1}] unless score @s location_updated matches 1 store success score @s location_updated run data modify entity @s WanderTarget set from storage trader:data WanderTarget[1]
CCA: scoreboard players add @e[tag=myTrader] location_id 1
CUA: execute as @e[tag=no_target, scores={location_id=2}] unless score @s location_updated matches 1 run data modify entity @s WanderTarget set from storage trader:data WanderTarget[2]
CCA: scoreboard players set @e[tag=myTrader] location_id 0
CUA: scoreboard players reset @e[tag=myTrader] location_updated_updated
CUA: tag @e[tag=no_target] remove no_target




Other Videos By Infernal Device


2024-05-20322: Is the player sneaking and similar predicates: No datapack needed. [Minecraft Map Making]
2024-05-19321: Eat any item and right-click detection. [Minecraft Map Making]
2024-05-17320: More items means better buffs. [Minecraft Map Making]
2024-05-17319: Villager processing. Bones in, villagers out. [Minecraft Map Making]
2024-05-16318: Entity that follows another entity. [Minecraft Map Making]
2024-05-15317: Grow crops faster with a sprinkler. [Minecraft Map Making]
2024-05-15CoppitCraft Castle 048: Castle roof... Well, it's on top of the castle.
2024-05-14316: First attempt at a Wandering Beekeeper. [Minecraft Map Making]
2024-05-13315: Experiments with accelerated crop growth. [Minecraft Map Making]
2024-05-12314: Floo powder from Harry Potter. [Minecraft Map Making]
2024-05-09311: Controlling a wandering trader. [Minecraft Map Making]
2024-05-01300: Playing fetch with a fox. Experiment. [Minecraft Map Making]
2024-04-30299: Jetpack on a stick. [Minecraft Map Making]
2024-04-29298: Checking banner patterns with commands. [Minecraft Map Making]
2024-04-28297: Recipe giving and click detection with knowledge books. [Minecraft Map Making]
2024-04-27296: Phase shifting through blocks. [Minecraft Map Making]
2024-04-26CoppitCraft Castle 047: Working on the front gate.
2024-04-26295: Playing with leads. [Minecraft Map Making]
2024-04-25294: Improved Mario coin block with tools for easy creation. [Minecraft Map Making]
2024-04-24293: Stop mobs entering or leaving an area. [Minecraft Map Making]
2024-04-23292: Controllable 3 * 3 moving platform. [Minecraft Map Making]



Tags:
minecraft
adventure map
map making
commands
command blocks
1.18
custom commands
redstone
map ideas
map suggesstions
custom maps
1.19



Other Statistics

Minecraft Statistics For Infernal Device

At present, Infernal Device has 181,586 views spread across 859 videos for Minecraft, accounting for over 10 days of watchable video on his channel. This is 94.82% of the total watchable video for Minecraft on Infernal Device's YouTube channel.