Skip to content

Commit

Permalink
Added distance to ObservationFromRay
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveyBiggers committed Mar 14, 2017
1 parent 38bb9e4 commit 325bdc3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ else if (prop.getValueClass() == Integer.class)
}
}
jsonMop.addProperty("inRange", hitDist <= blockReach);
jsonMop.addProperty("distance", hitDist);
}
else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY)
{
Expand Down Expand Up @@ -145,6 +146,7 @@ else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY)
jsonMop.addProperty("hitType", hitType);
}
jsonMop.addProperty("inRange", hitDist <= entityReach);
jsonMop.addProperty("distance", hitDist);
}
json.add("LineOfSight", jsonMop);
}
Expand Down
2 changes: 1 addition & 1 deletion Schemas/MissionHandlers.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -1483,7 +1483,7 @@
<xs:documentation>
When present, the Mod will return a JSON object called "LineOfSight", containing observations about the block or entity which is currently in the centre of the screen:

* Hit details: {{{hitType}}} - will be "block" for a block, "entity" for an entity (eg spider, rabbit etc) or "item" for a free-floating item that can be picked up. {{{inRange}}} will be true if the block/entity is within the agent's reach - ie attacking or using will have an effect on the object.
* Hit details: {{{hitType}}} - will be "block" for a block, "entity" for an entity (eg spider, rabbit etc) or "item" for a free-floating item that can be picked up. {{{inRange}}} will be true if the block/entity is within the agent's reach - ie attacking or using will have an effect on the object. {{{distance}}} gives the straight-line distance from the agent.
* Position: {{{x}}}, {{{y}}}, {{{z}}} - in the case of block hits, will be the precise point when the ray intercepts the block.
* Type information: {{{type}}}, {{{colour}}}, {{{variant}}}, {{{facing}}}
* Extra properties: in the case of block types, any extra properties will be returned by their minecraft name, prefixed with "prop_" (eg, for leaves, "prop_decayable" and "prop_check_decay") - this is the same data as can be seen by exploring Minecraft with the F3 debug information displayed. For floating items, the stack size is returned in {{{stackSize}}}
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.?
-------------------
New: ObservationFromRay now returns distance.

0.21.0
-------------------
New: yaw and pitch added to nearby entity observations.
Expand Down

0 comments on commit 325bdc3

Please sign in to comment.