🛒 Shopping Kart is a datapack that lets you ride various vehicles in Minecraft, it is not intended to be used in a survival server but rather in a minigame or a custom server.
🎮 Core Commands
/function shopping_kart:kart/summon: Spawns a default vehicle
/function shopping_kart:kart/switch_model/summon_new_kart: Spawns a vehicle with current player's selected model
/trigger shopping_kart.trigger_model set <number>: Sets the current player's selected model to the given number. Special cases are:
number > 0: Specific model number
-1: Next model
-2: Previous model
-3: Ride the nearest kart
-4: Random model
A kart left without a player can be mounted again with a right click on its top once it has stopped.
⚙️ Configuration Commands
Fine-tune your shopping kart experience with these configuration commands!
Kart Effects and Controls 🎛️
The following tags and scoreboards are applied to the kart entity (tagged shopping_kart.kart). You can run the commands in chat or from command blocks. The examples below affect every currently summoned kart.
Effect
Command to enable
Command to disable
What it does
Forced acceleration
tag @e[tag=shopping_kart.kart] add shopping_kart.forced_acceleration
tag @e[tag=shopping_kart.kart] remove shopping_kart.forced_acceleration
Accelerates in the kart's facing direction without requiring steering input. By default, the kart follows its passenger's facing direction.
No steering
tag @e[tag=shopping_kart.kart] add shopping_kart.no_steering
tag @e[tag=shopping_kart.kart] remove shopping_kart.no_steering
Keeps the kart's current facing direction instead of following the passenger's yaw. Can be combined with forced acceleration.
Engine off
tag @e[tag=shopping_kart.kart] add shopping_kart.engine_off
tag @e[tag=shopping_kart.kart] remove shopping_kart.engine_off
Prevents normal acceleration from building engine power; any existing power continues to drain.
No grip
tag @e[tag=shopping_kart.kart] add shopping_kart.no_grip
tag @e[tag=shopping_kart.kart] remove shopping_kart.no_grip
Makes the kart handle as if it were on a slippery surface, regardless of the block underneath it.
Cruise control
scoreboard players set @e[tag=shopping_kart.kart] shopping_kart.cruise_control 1
scoreboard players set @e[tag=shopping_kart.kart] shopping_kart.cruise_control 0
Holds the current engine level: normal engine drain and steering-driven engine gain are suspended until disabled. Steering still works; boosters can still modify the engine level.
Collisions
scoreboard players set @e[tag=shopping_kart.kart] shopping_kart.collision_factor 1000
scoreboard players set @e[tag=shopping_kart.kart] shopping_kart.collision_factor 0
Makes a kart, ridden or not, collide with the karts and players on foot it touches, which vanilla never does for an entity carrying passengers. A fast kart hands its speed to what it hits, then the factor pushes them apart: 1000 is the default strength, 5000 is five times stronger. At 0 the kart neither hits nor is hit.
Restitution
scoreboard players set @e[tag=shopping_kart.kart] shopping_kart.restitution 1000
scoreboard players set @e[tag=shopping_kart.kart] shopping_kart.restitution 0
How much speed a collision gives back. At 1000 a kart hitting a still one stops and hands over all its speed, at 0 both roll on together at half the speed, 500 is the default. Two karts use the lower of their values, and one hit transfers at most 1 block per tick.
For example, put the cruise-control enable command in an impulse command block to activate it once. Use the disable command to return to normal engine drain and acceleration. A repeating command block is not needed.
To give all current karts a temporary reactor boost, set its duration in ticks (20 ticks = 1 second):
scoreboard players set @e[tag=shopping_kart.kart] shopping_kart.reactor_boost 100
The reactor boost increases acceleration and movement for 100 ticks. The score counts down automatically.
A new kart takes its collision factor from #default_collision_factor shopping_kart.data, 1000 by default, and its restitution from #default_restitution shopping_kart.data, 500 by default. A datapack built on Shopping Kart sets them for the karts it summons next:
scoreboard players set #default_collision_factor shopping_kart.data 5000
scoreboard players set #default_restitution shopping_kart.data 1000
Shopping Kart's load function sets them back to their defaults on every /reload, so set them after Shopping Kart has loaded, for instance when your game starts.
A kart pushes a player on foot through the Player Motion API library, so install it next to Shopping Kart. Without it, karts still slow down when they hit a player, but the player is not pushed.
A hit player is not lifted by default. #player_lift shopping_kart.data adds an upward speed to the push, 10000 per block per tick, so a game mode that throws players into the void can send them further (an airborne player loses less speed than one sliding on the ground):
scoreboard players set #player_lift shopping_kart.data 2000
Like the defaults above, it is set back to 0 on every /reload.
The speed_up and speed_down effects are handled automatically while driving: steering input accelerates the kart, and engine power naturally drains when not using cruise control. Drive over magenta glazed terracotta to activate a directional booster.
Surface Settings ⚡
Control how the kart behaves on different surfaces with the shopping_kart:kart_surfaces/ block tags in the datapack's data/shopping_kart/tags/block/kart_surfaces/ folder:
Surface Type
Description
Normal
Blocks not in one of the surface tags
Fast
Colored concrete
Slippery
Ice, packed ice, and blue ice
Slow
Dirt, sand, gravel, grass, and other rough terrain
Very Slow
Soul sand, mud, honey blocks, slime blocks, and similar terrain
Edit the corresponding fast.json, slippery.json, slow.json, or very_slow.json block tag to customize which blocks use each surface behavior. The no_grip tag overrides these settings and forces slippery handling.
Special Features 🌟
🏎️ Directional boosters: Magenta glazed terracotta pushes the kart in the direction the block faces.
🚀 Reactor boost: Temporarily increases acceleration and movement; activate it with the shopping_kart.reactor_boost scoreboard as shown above.
🌊 Water: Kart buoyancy and vertical movement are adjusted automatically while it is in water.
📡 Signals
A datapack reacts to kart events by adding its functions to these function tags, in its own data/shopping_kart/tags/function/signals/<signal>.json. Shopping Kart calls a signal only when its event happens, so an unused signal costs nothing per tick.
Signal
When
@s, at its position
Selectors
Readable data
#shopping_kart:signals/kart_spawned
A kart is summoned, including the new kart of a model switch
The new kart
The summoning player carries shopping_kart.owner
@s shopping_kart.id, the model number in #model shopping_kart.data
#shopping_kart:signals/kart_mounted
Shopping Kart seats a player: right click on a stopped empty kart, the ride after a summon or a model switch, trigger -3
The seated player
The kart is execute on vehicle
The kart's shopping_kart.id
#shopping_kart:signals/kart_collision
A kart hits another kart and hands it speed
The struck kart
shopping_kart.victim: the struck kart and its driver. shopping_kart.attacker: the striking kart and its driver
Both karts' shopping_kart.id, the speed handed over in #j shopping_kart.data (10000 per block per tick)
#shopping_kart:signals/player_hit
A kart launches a player on foot, once per hit
The hit player
shopping_kart.victim: the player. shopping_kart.attacker: the kart and its driver
The kart's shopping_kart.id, #j shopping_kart.data
The shopping_kart.victim and shopping_kart.attacker tags exist only while the signal runs, so any function in the tag can select them. For example, to credit the driver with a hit:
评论 0
登录后参与评分
还没有评论,来抢沙发吧