From 325bdc3a7fba94a45b5a186145284291c2e7d76e Mon Sep 17 00:00:00 2001 From: davey Date: Tue, 14 Mar 2017 10:55:53 +0000 Subject: [PATCH] Added distance to ObservationFromRay --- .../MissionHandlers/ObservationFromRayImplementation.java | 2 ++ Schemas/MissionHandlers.xsd | 2 +- changelog.txt | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/ObservationFromRayImplementation.java b/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/ObservationFromRayImplementation.java index 326a64269..d7396ab27 100755 --- a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/ObservationFromRayImplementation.java +++ b/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/ObservationFromRayImplementation.java @@ -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) { @@ -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); } diff --git a/Schemas/MissionHandlers.xsd b/Schemas/MissionHandlers.xsd index 2e112bdf5..c349fd82c 100755 --- a/Schemas/MissionHandlers.xsd +++ b/Schemas/MissionHandlers.xsd @@ -1483,7 +1483,7 @@ 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}}} diff --git a/changelog.txt b/changelog.txt index 88ef4fe16..16e131da9 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,7 @@ +0.? +------------------- +New: ObservationFromRay now returns distance. + 0.21.0 ------------------- New: yaw and pitch added to nearby entity observations.