use of com.microsoft.Malmo.Schemas.MovingTargetDecorator in project malmo by Microsoft.
the class MovingTargetDecoratorImplementation method parseParameters.
@Override
public boolean parseParameters(Object params) {
if (params == null || !(params instanceof MovingTargetDecorator))
return false;
this.targetParams = (MovingTargetDecorator) params;
this.arenaBounds = this.targetParams.getArenaBounds();
DrawBlockBasedObjectType targetBlock = this.targetParams.getBlockType();
this.blockType = (targetBlock != null) ? new XMLBlockState(targetBlock.getType(), targetBlock.getColour(), targetBlock.getFace(), targetBlock.getVariant()) : null;
Pos pos = this.targetParams.getStartPos();
int xPos = pos.getX().intValue();
int yPos = pos.getY().intValue();
int zPos = pos.getZ().intValue();
// Check start pos lies within arena:
xPos = Math.min(this.arenaBounds.getMax().getX(), Math.max(this.arenaBounds.getMin().getX(), xPos));
yPos = Math.min(this.arenaBounds.getMax().getY(), Math.max(this.arenaBounds.getMin().getY(), yPos));
zPos = Math.min(this.arenaBounds.getMax().getZ(), Math.max(this.arenaBounds.getMin().getZ(), zPos));
this.startPos = new BlockPos(xPos, yPos, zPos);
if (this.targetParams.getUpdateSpeed() == null || this.targetParams.getUpdateSpeed().equals("turnbased")) {
this.mustWaitTurn = true;
} else {
this.speedInTicks = Integer.parseInt(this.targetParams.getUpdateSpeed());
}
createRNG();
return true;
}
Aggregations