0

Is it possible to use command blocks to detect an empty boat in 1.10? I tried to use the data tag Passengers:[], but it seems that empty boats do not even have the Passengers attribute.

The desired functionality is shown below.

successful with empty boat unsuccessful with passenger

1 Answer 1

4

Add an "EmptyBoat" tag to all boats:

/scoreboard players tag @e[type=Boat] add EmptyBoat

Remove this from boats that are not empty:

/scoreboard players tag @e[type=Boat] remove EmptyBoat {Passengers:[{}]}
/scoreboard players tag @a remove InBoat
/scoreboard players tag @a add InBoat {RootVehicle:{Entity:{id:Boat}}}
/execute @a[tag=InBoat] ~ ~ ~ /scoreboard players tag @e[c=1,type=Boat,r=1] remove EmptyBoat

The last three commands are needed because, when a boat has only players in it, it still doesn't have a Passengers tag, but instead the players will have a RootVehicle tag.

Then you can test for boats that are empty like this:

/testfor @e[tag=EmptyBoat]
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .