/testfor troubles in 1.9

/testfor troubles in 1.9 - Blurred world map with total number of people infected by coronavirus and statistics of various countries

I made a map in 1.8.9 using lots of commands blocks containing /testfor commands. However, once I went into the most recent snapshot (1.9-pre4) and started messing around with more /testfor stuff, the commands were "invalid". I tried using both chain command blocks and a 20Hz clock with normal command blocks, and none worked. Even the /testfor commands which I put in while playing on 1.8.9 stopped working. Is this just a bug waiting to be fixed, or is the /testfor command being changed?

The command I'm using is:

/testfor @p[204,9,59,0]


Best Answer

In 1.9, the r parameter has undergone some major changes. Prior to 16w07a, the produced radius and entity selection was very inconsistent. MC-95352 resulted in various different fix attempts.

For comparison, in 1.8 r=0 would target entities within the whole blockspace. As well, it would latch onto the block grid even when executed by an entity.

In 16w07a, the radius was fixed to be consistent and execute from the center of the block, but there was no offset to the input value. For example, r=0 would literally mean "these exact coordinates with no leniency". If any entity was not in the exact center of a block, it could not be targeted.

In 16w07b, the radius was changed to execute from the bottom face of the blockspace rather than the center, and the offset to the radius was set to 0.25. This meant that with r=0 (which essentially meant r=0.25), an entity had to be within a small part of the center of the block, rather than the whole blockspace in 1.8.

In 1.9 pre-release 3, the radius offset was changed to 0.015625 (r=0 meant r=0.015625).

And finally in 1.9 pre-release 4, the offset was removed again and r=0 meant "exactly at this location" once more. However, a major changed occurred here: the radius, when executed by an entity, no longer latches onto the block grid and instead used the entity as the origin. This means that with entities, you'd actually be searching around the entity rather than the block that they're in. See MC-97316 for details.

Since r=0 means "exactly at these coordinates" rather than "within this blockspace", you will not be able to use it absolutely anymore. You will need to change it to r=1 (which indeed means 1 block exactly in each direction, reaching to the center of the neighboring blocks).




Pictures about "/testfor troubles in 1.9"

/testfor troubles in 1.9 - Black woman in face shield and mask standing near escalator
/testfor troubles in 1.9 - Emotionless black woman in protective mask and face shield
/testfor troubles in 1.9 - Side view of African American couple in protective masks and casual clothes standing and quarreling in light room in daytime



Is Testfor still in Minecraft?

You can test for a certain target in the game using the /testfor command in Minecraft. TIP: Starting in Minecraft Java Edition (PC/Mac) 1.13, the /testfor command was removed from the Java Edition version of the game.

What replaced the Testfor command in Minecraft?

The /testfor command became obsolete in Minecraft 1.13, and has been replaced by the /execute command*. It will do the same as typing /testfor @e {SelectedItem:{id:"<item>"}} and then putting a comparator to the command block with the command, and then running the command which you wanna run.



Testfor Command Tutorial 1.9 And Under




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Anton Uniqueton, Laura James, Laura James, Monstera