Search in sources :

Example 1 with BlockOrItemSpec

use of com.microsoft.Malmo.Schemas.BlockOrItemSpec in project malmo by Microsoft.

the class MazeDecoratorImplementation method initBlocksAndHeights.

private void initBlocksAndHeights() {
    this.startBlock = getBlock(this.mazeParams.getStartBlock(), this.blockrand);
    this.endBlock = getBlock(this.mazeParams.getEndBlock(), this.blockrand);
    this.floorBlock = getBlock(this.mazeParams.getFloorBlock(), this.blockrand);
    this.pathBlock = getBlock(this.mazeParams.getPathBlock(), this.blockrand);
    this.optimalPathBlock = this.mazeParams.getOptimalPathBlock() != null ? getBlock(this.mazeParams.getOptimalPathBlock(), this.blockrand) : this.pathBlock;
    this.subgoalPathBlock = this.mazeParams.getSubgoalBlock() != null ? getBlock(this.mazeParams.getSubgoalBlock(), this.blockrand) : this.optimalPathBlock;
    this.gapBlock = getBlock(this.mazeParams.getGapBlock(), this.blockrand);
    if (this.mazeParams.getWaypoints() != null) {
        if (this.mazeParams.getWaypoints().getWaypointBlock() != null)
            this.waypointBlock = getBlock(this.mazeParams.getWaypoints().getWaypointBlock(), this.blockrand);
        else {
            BlockOrItemSpec bis = this.mazeParams.getWaypoints().getWaypointItem();
            DrawItem di = new DrawItem();
            di.setType(bis.getType().get(this.blockrand.nextInt(bis.getType().size())));
            if (bis.getColour() != null && !bis.getColour().isEmpty())
                di.setColour(bis.getColour().get(this.blockrand.nextInt(bis.getColour().size())));
            if (bis.getVariant() != null && !bis.getVariant().isEmpty())
                di.setVariant(bis.getVariant().get(this.blockrand.nextInt(bis.getVariant().size())));
            this.waypointItem = MinecraftTypeHelper.getItemStackFromDrawItem(di);
        }
    }
    this.startHeight = getHeight(this.mazeParams.getStartBlock(), this.pathrand);
    this.endHeight = getHeight(this.mazeParams.getEndBlock(), this.pathrand);
    this.pathHeight = getHeight(this.mazeParams.getPathBlock(), this.pathrand);
    this.optimalPathHeight = this.mazeParams.getOptimalPathBlock() != null ? getHeight(this.mazeParams.getOptimalPathBlock(), this.pathrand) : this.pathHeight;
    this.subgoalHeight = this.mazeParams.getSubgoalBlock() != null ? getHeight(this.mazeParams.getSubgoalBlock(), this.pathrand) : this.optimalPathHeight;
    this.gapHeight = getHeight(this.mazeParams.getGapBlock(), this.pathrand);
}
Also used : BlockOrItemSpec(com.microsoft.Malmo.Schemas.BlockOrItemSpec) DrawItem(com.microsoft.Malmo.Schemas.DrawItem)

Aggregations

BlockOrItemSpec (com.microsoft.Malmo.Schemas.BlockOrItemSpec)1 DrawItem (com.microsoft.Malmo.Schemas.DrawItem)1